So week 6 of coding just went down. In coding week 6, I again worked on the Portal repository (I worked on Hyperkitty last week). The week's task was basically about laying a foundation for setting up continuous integration on the project. As a result, 5 shell scripts (prepared for Jenkins) were added and the Django test runner was changed.
Project Name : Portal (Infrastructure Automation) – Systers
Repository : Systers Portal Repository - GitHub
Task(s) : Add continues integration automation scripts (main task)
Issue (s) : #418 , #419 (stretch)
Status : Completed (continues improvements required)
Tests have been written and coverage is at 99% at the time of writing, from there we can do more. Can we easily look at details about the coverage report? Can we see "lint graphs" that shows up how our code has evolved? what about getting XML reports, HTML and more? This week's task is about answering these questions. Technically the week's task included adding a few scripts that would be developed further/fine-tuned along with the Pytest test runner for Django which will permit us to get very extensive reports from our pipelines, and allow a lot of flexibility for continues integration and particularly Jenkins in our case.
What has changed
Addition of 5 shell scripts in a new scripts folder: Each script to run tests with one or more types of report e.g
run_test_with_cov would yield just coverage reports, while
run_test_with_lint would run tests, lint and yield lint reports,
run_test_with_junitxml will cause an XML report to be generated. Finally,
run_test_will_all will yield all reports and is the script that would be called in Jenkins all these scripts basically call a base script know as simply as
The replacement of the Django nose test runner with Pytest runner: It provides better reporting and more flexibility with plenty of operations
Tweak the project a little to allow Pytest runner work from project root and run seamlessly: Had to play around to get Pytest runner work with our structure the biggest success was deleting the file
__init__.py from the
systers_portal project container (directory) of apps.
The major challenge was changing the test runner and getting it to work so I can write Pytest shell scripts. A lot of things went and a lot of time was wasted(or invested) trying different solutions due to misleading errors but the solution was simple after reading a log carefully investigated as an issue at Pytest development repo. It was one of the import subtleties.