-
Notifications
You must be signed in to change notification settings - Fork 76
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
Introduce a way to run test in parallel #1025
Comments
Hi @benoit-cty and thanks for this issue. I see there is an option overlap regarding So I've tried this:
And got:
The same result you had, so I confirm that it actually overrides OpenFisca's test collector. |
Tried directly adding the option to # openfisca_command.py
def build_test_parser(parser):
parser.add_argument('path', help = "paths (files or directories) of tests to execute", nargs = '+')
parser = add_tax_benefit_system_arguments(parser)
parser.add_argument('-n', '--name_filter', default = None, help = "partial name of tests to execute. Only tests with the given name_filter in their name, file name, or keywords will be run.")
parser.add_argument('-p', '--pdb', action = 'store_true', default = False, help = "drop into debugger on failures or errors")
parser.add_argument('--performance-graph', '--performance', action = 'store_true', default = False, help = "output a performance graph in a 'performance_graph.html' file")
parser.add_argument('--performance-tables', action = 'store_true', default = False, help = "output performance CSV tables")
parser.add_argument('-v', '--verbose', action = 'store_true', default = False, help = "increase output verbosity")
parser.add_argument('-o', '--only-variables', nargs = '*', default = None, help = "variables to test. If specified, only test the given variables.")
parser.add_argument('-i', '--ignore-variables', nargs = '*', default = None, help = "variables to ignore. If specified, do not test the given variables.")
parser.add_argument('-d', '--distributed', nargs = 1, default = None, help = "run tests distributed. Use `auto` to detect the number of cores.") # run_test.py
options = {
'pdb': args.pdb,
'performance_graph': args.performance_graph,
'performance_tables': args.performance_tables,
'verbose': args.verbose,
'name_filter': args.name_filter,
'only_variables': args.only_variables,
'ignore_variables': args.ignore_variables,
'distributed': args.distributed,
} # test_runner.py
argv = ["--capture", "no"]
if options.get('pdb'):
argv.append('--pdb')
if options.get("distributed"):
argv.append(f"--numprocesses={options.get('distributed')[0]}") Results where not better:
|
Thanks for investigating, I think I will open an issue in Xdist to get some help. |
|
So it seems It seems to me that the solution is to hook up Hope it helps! |
Thanks for all the details, I've openned an XDist Issue: pytest-dev/pytest-xdist#677 |
pytest-dev/pytest-xdist#681 (comment)
|
If I understand that correctly, Why doesn't |
Hello @MattiSG,
As I currently understand it yes, because of the way we use
At the time of that discussion, |
By the way, I've got parallel tests probably working here, to be tested with France for example. |
@HAEKADI since you have created a GitHub Actions syntax to try out parallel tests in #1027, could you please investigate if @benoit-cty’s suggestion to use https://github.com/nektos/act would also work for parallelising locally? 😃 |
I investigated the use of |
Hi there!
I really enjoy OpenFisca, but I recently encountered an issue.
Here is what I did:
openfisca test --country-package openfisca_france tests
Here is what I expected to happen:
Use of all the core of my CPU to run test so that it took less than 3 minutes.
Here is what actually happened:
Only one core is used, so test took 17 minutes.
Context
I identify more as a:
Experimentation I have made
Use GNU parallel
find tests/**/*.{yaml,yml} | parallel -j 32 --progress openfisca test --country-package openfisca_france | grep FAILED
Pros:
Cons:
grep FAILED
for example.sudo apt-get install parallel
.Use of Xdist
pytest-xdist is a Pytest plugins that run test in parallel.
To use it:
pip install pytest-xdist[psutil]
Add in setup.cfg:
Run the test
openfisca test --country-package openfisca_france tests
Pros:
Cons:
It seems that the OpenFisca pytest plugin https://github.com/openfisca/openfisca-core/blob/master/openfisca_core/tools/test_runner.py need to override some xdist method to give it the right test.
Use pytest-parallel
https://github.com/browsertron/pytest-parallel
Not tested, it seems to work like Xdist, so may have the same problem.
The text was updated successfully, but these errors were encountered: