-
Notifications
You must be signed in to change notification settings - Fork 664
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
Attempt to parallelize unit tests #2139
Attempt to parallelize unit tests #2139
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 goes against my previous effort to simplify the travis file.
I see no reason why we would want to define a PYTEST_ADDOPS variable that is different specially for unit tests. Instead just define a global one that would be inhered by all travis jobs.
@@ -167,9 +172,11 @@ def molecule_scenario_directory_fixture(molecule_directory_fixture): | |||
|
|||
@pytest.fixture | |||
def molecule_ephemeral_directory_fixture(molecule_scenario_directory_fixture): | |||
path = pytest.helpers.molecule_ephemeral_directory() | |||
path = pytest.helpers.molecule_ephemeral_directory(str(uuid4())) |
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 worries me a little bit because potential piling up of remaining file if you break execution. Can't we make the unique code predictable based on test name and python interpreter used, or something similar.
Feel free to ignore my comment if it too hard to fix at this stage, is more of a question, as we can always fix it later.
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.
Actually, everything is cleaned up. See https://github.com/ansible/molecule/pull/2139/files#diff-93a7df2f35536e469f98fe57544195f7R178. Pytest works like this: yield hands the fixture to the test and then when the test is finished, whatever comes after the yield is the "teardown". So we delete each folder as we make it.
This is an interim step towards just writing I don't see this as complicating the Travis configuration. Arguably it refactors it. It takes a constant and puts it in one place (instead of all over the place) and then references that. When we can paralleliza all the tests, we just remove this: "PYTEST_ADDOPTS: >- '-n auto'" and we're done. |
d215eb8
to
78fc953
Compare
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.
- Move the
-n auto
to the Toxunit
configuration - Experiment with only doing
shutil.rmtree(path)
locally and not on the CI (machine thrown away anyway) to increase speed of run time
Done in #2140. |
After #2137, I think I understand a little further that the unit tests fixtures just "pretend" to build up the usual config/state folder hierarchy manually. So, we override that to add in a random UUID and push
-n auto
into only the unit test environments from the Travis configuration. This might work ...Another one for #1702.