-
Notifications
You must be signed in to change notification settings - Fork 685
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
Documentation for tool tox
#11165
Documentation for tool tox
#11165
Conversation
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.
This is a good idea and I love the various examples.
@@ -15,9 +15,44 @@ To add a script to be checked with mypy use the `mypy_test` macro in `tests/CMak | |||
|
|||
### Unit Tests | |||
|
|||
`ctest` is used to run the unit tests for the `ssg` python package that is in the repo. | |||
`ctest` is used to run the unit tests for the `ssg` python package that is in the repo. But you need to build content and `ctest` isn't able to run unit tests with differed versions of python. To run only unit tests with differed version of python for the `ssg` python package is recommended to use `tox`. |
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.
This is against the Style Guide https://github.com/ComplianceAsCode/content/blob/master/docs/manual/developer/04_style_guide.md#markup-languages which says that we shall have one sentence per line.
@@ -15,9 +15,44 @@ To add a script to be checked with mypy use the `mypy_test` macro in `tests/CMak | |||
|
|||
### Unit Tests | |||
|
|||
`ctest` is used to run the unit tests for the `ssg` python package that is in the repo. | |||
`ctest` is used to run the unit tests for the `ssg` python package that is in the repo. But you need to build content and `ctest` isn't able to run unit tests with differed versions of python. To run only unit tests with differed version of python for the `ssg` python package is recommended to use `tox`. |
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.
Python should be with capital P.
@@ -15,9 +15,44 @@ To add a script to be checked with mypy use the `mypy_test` macro in `tests/CMak | |||
|
|||
### Unit Tests | |||
|
|||
`ctest` is used to run the unit tests for the `ssg` python package that is in the repo. | |||
`ctest` is used to run the unit tests for the `ssg` python package that is in the repo. But you need to build content and `ctest` isn't able to run unit tests with differed versions of python. To run only unit tests with differed version of python for the `ssg` python package is recommended to use `tox`. |
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.
different
@@ -15,9 +15,44 @@ To add a script to be checked with mypy use the `mypy_test` macro in `tests/CMak | |||
|
|||
### Unit Tests | |||
|
|||
`ctest` is used to run the unit tests for the `ssg` python package that is in the repo. | |||
`ctest` is used to run the unit tests for the `ssg` python package that is in the repo. But you need to build content and `ctest` isn't able to run unit tests with differed versions of python. To run only unit tests with differed version of python for the `ssg` python package is recommended to use `tox`. |
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 don't understand what you mean by "But you need to build content and ..." . If you mean that you need to build SCAP content in order to run unit tests then that's not true.
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.
If I understand documentation correctly? It means that the unit tests are part of the ctest
test suite, and before running ctest
you need to execute the ./build_product
command to build the content. For tox
, just clone the repo, install tox
and run it.
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.
But we're talking about Python unit tests of the ssg
Python package. For them to run, you don't have to build anything, it's enough to just configure:
cd build
rm -rf *
cmake ..
ctest -R python-unit-ssg-module
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.
Okay, I'll add it to the documentation. This information was missing from the documentation.
`ctest` is used to run the unit tests for the `ssg` python package that is in the repo. | ||
`ctest` is used to run the unit tests for the `ssg` python package that is in the repo. But you need to build content and `ctest` isn't able to run unit tests with differed versions of python. To run only unit tests with differed version of python for the `ssg` python package is recommended to use `tox`. | ||
|
||
Note that `tox` creates a virtual environment that handles all dependencies defined in the test request file and performs unit tests with multiple versions of python. Thus, you can test your changes with different versions of python on your machine and don't have to wait for the upstream CI to check them for you. |
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.
Python should be with capital P.
|
||
*You must be in the root directory of the project before running the `tox` command.* | ||
|
||
Runs tests with python2, python3.8, python3.9 and python3-latest on machine: |
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.
Is the python2
Python 2.7 or which version?
`ctest` is used to run the unit tests for the `ssg` python package that is in the repo. | ||
`ctest` is used to run the unit tests for the `ssg` python package that is in the repo. But you need to build content and `ctest` isn't able to run unit tests with differed versions of python. To run only unit tests with differed version of python for the `ssg` python package is recommended to use `tox`. | ||
|
||
Note that `tox` creates a virtual environment that handles all dependencies defined in the test request file and performs unit tests with multiple versions of python. Thus, you can test your changes with different versions of python on your machine and don't have to wait for the upstream CI to check them for you. |
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 omit the "Note that"
/packit retest-failed |
Code Climate has analyzed commit fca6810 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 56.9%. View more on Code Climate. |
/packit retest-failed |
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 like these changes very much! They're really detailed and precise.
The TF CS9 fail is tracked in #11179 and isn't caused by the changes in this PR.
/packit retest-failed |
2 similar comments
/packit retest-failed |
/packit retest-failed |
@jan-cerny All tests were successful. |
Description:
This PR creates documentation for the use of
tox
. And disables the automatic execution offlake8
when usingtox
.