-
Notifications
You must be signed in to change notification settings - Fork 32
PyTest Migration #144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
PyTest Migration #144
Conversation
diaconuccalin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great feature, fantastically useful! :)
One more comment other than the ones I've already left, maybe add the instructions you included in the PR description to a dedicated .md file in the DeeployTest directory, with a mention of it in the big README, for better documentation for future users (including myself :) ).
| IMAGE="ghcr.io/pulp-platform/deeploy:main" | ||
| else | ||
| IMAGE="ghcr.io/pulp-platform/deeploy:devel" | ||
| IMAGE="ghcr.io/victor-jung/deeploy:pytest-migration" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's only draft, but don't forget this hard-coded path :)
DeeployTest/test_generic.py
Outdated
| import pytest | ||
| from testUtils.pytestRunner import DeeployTestConfig, get_test_paths, get_worker_id, run_complete_test | ||
|
|
||
| KERNEL_TESTS = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would move these lists in a dedicated file since they're only going to get bigger in time. I would keep the current file only as a test setup file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes sense, especially when I'll adapt the PR for several platforms. Then I would have a deeploytest.py (or test_suite.py) file where I declare the test functions with markers (what is currently test_generic.py) for every platform. On the side, I'll make a dedicated file per platform with the lists of test names.
…test, fix generic runner
We used to write the tests directly in the GitHub Action YAML files; this is not a good practice, as it is hard to run several tests locally. PyTest is a well-known test framework that allows decoupling the testing from the GitHub CI, so users can easily run all tests for any platform locally if needed.
Currently, I use PyTest only for the Generic platform. I'd like a first round of review from @Xeratec or @diaconuccalin before moving forward. Moving the CI for other platforms will be done in a similar way.
Additionally, the PyTest suite can run tests in parallel and generate one build folder per worker to prevent conflicts.
Tagging @haugoug as he's interested in this feature.
To run all the tests of the generic platform with 8 parallel threads, you can do
You can select a specific marker with
-m, like only the kernels, you can do:To list all the captured tests for a given expression, you can do:
To execute a specific test, you can use:
You can also use an expression to filter tests, for instance the following command execute all test whose name contain "Adder":
Added
pytestandpytest-xdistas dependencies of Deeploy.pytest.inifor the global configuration of PyTest for the project.conftest.pyto define CLI args for PyTest for the whole project, it also defines a set of global fixtures.pytestRunner.pycontains helper functions and fixtures for the whole project.test_generic.pylists the tests and sorts them into marked categories (per platform and per kernel/model).Changed
ci-platform-generic.ymland_runner_generic.ymlto call the generic platform PyTest suite with a given marker.Fixed
nvidia-pyindexwas broken as it now tries to build the wheel to respect the new policy on packages usingpyproject. Instead of installing this package, we just add thehttps://pypi.ngc.nvidia.comchannel to the pip config file.PR Merge Checklist
develcommit and pointing todevel.CHANGELOG.mdfile has been updated.