question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ape hijacks pytest, not allowing pytest to be used independently or pytest-xdit to be used

See original GitHub issue

Environment information

Ape version was beta 0.1.3 and this issue surfaced before plug-in installation.

  • Python Version: 3.8
  • OS: macOS

I’m using poetry with ape as a dev dependency.

What went wrong?

When I run poetry run pytest ape reports “no provider name test” After that I switched to running poetry run ape test, which worked fine as a replacement. However, recently started using pytest-xdist for test parallelization and when running poetry run ape test -n auto, the same error occurs. Had to uninstall ape to be able to test directly with pytest.

How can it be fixed?

Fill this in if you have ideas on how the bug could be fixed.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
Pet3riscommented, Feb 24, 2022

Thanks @unparalleled-js - I did this on a non-ape repo:

poetry add --dev git+https://github.com/unparalleled-js/ape.git#fix/test-race-cond
poetry run pytest

Can confirm it works now, which didn’t work on main.

1reaction
unparalleled-jscommented, Feb 24, 2022

Maybe to add more color on the consequences of using global package state from a python module: I used a conda environment to create a poetry env for ape development. After uninstalling ape to be able to use pytest parallelization (the issue above), I created another poetry env based on this conda environment. However, this env still has ape_test and ape and I cannot uninstall them. Moreover it seems to have modified some internal pytest registry so I’m not able to test. I had to delete the conda env altogether 😦.

I don’t understand why ape is still installed in a new environment; that must be related to conda?. For now, to turn off the ape-test pytest plugin, you either have to use ape in separate environment or use the -p no:ape_test option when invoking pytest.

https://stackoverflow.com/questions/37924489/how-to-disable-pytest-plugins-for-single-tests

Read more comments on GitHub >

github_iconTop Results From Across the Web

Usage and Invocations — pytest documentation
This will run tests which contain names that match the given string expression (case-insensitive), which can include Python operators that use filenames, ...
Read more >
How to use skip and xfail to deal with tests that cannot succeed
A skip means that you expect your test to pass only if some conditions are met, otherwise pytest should skip running the test...
Read more >
How to use unittest-based tests with pytest
pytest supports running Python unittest -based tests out of the box. It's meant for leveraging existing unittest -based test suites to use pytest...
Read more >
Parametrizing tests — pytest documentation
In test_timedistance_v3 , we used pytest.param to specify the test IDs together with the actual data, instead of listing them separately.
Read more >
Changing standard (Python) test discovery - Pytest
The --ignore-glob option allows to ignore test file paths based on Unix ... To collect duplicate tests, use the --keep-duplicates option on the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found