According to the pytest
documentation, I can block a plugin using -p no:name
. I confirmed that this works for other plugins. However, when I try this with hypothesis
it has no effect:
(ska3-next) ➜ Chandra.Maneuver git:(master) pytest -v -p no:hypothesis Chandra/Maneuver
========================================================== test session starts ==========================================================
platform darwin -- Python 3.8.12, pytest-6.2.5, py-1.10.0, pluggy-1.0.0 -- /Users/aldcroft/miniconda3/envs/ska3-next/bin/python
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/Users/aldcroft/git/Chandra.Maneuver/.hypothesis/examples')
rootdir: /Users/aldcroft/git/Chandra.Maneuver, configfile: pytest.ini
plugins: remotedata-0.3.3, doctestplus-0.11.2, arraydiff-0.3, anyio-2.2.0, hypothesis-6.29.3, mock-3.6.1, filter-subpackage-0.1.1, openfiles-0.5.0, astropy-header-0.1.2, cov-3.0.0
collected 4 items
...
For context, the reason I want to block hypothesis
is another problem. For reasons outside the scope of this question, I need to run pytest
in a directory where I do not have write access. By default hypothesis
wants to create an database, and failing that it falls back to a memory database but in the process emits a warning. That warning is not desirable for our integration tests and I could find no way to suppress the warning.
(ska3-next) ➜ site-packages pytest -v -p no:hypothesis Chandra/Maneuver
========================================================== test session starts ==========================================================
platform darwin -- Python 3.8.12, pytest-6.2.5, py-1.10.0, pluggy-1.0.0 -- /Users/aldcroft/miniconda3/envs/ska3-next/bin/python
/Users/aldcroft/miniconda3/envs/ska3-next/lib/python3.8/site-packages/hypothesis/database.py:60: HypothesisWarning: The database setting is not configured, and the default location is unusable - falling back to an in-memory database for this session. path='/Users/aldcroft/miniconda3/envs/ska3-next/lib/python3.8/site-packages/.hypothesis/examples'
warnings.warn(
cachedir: .pytest_cache
hypothesis profile 'default' -> database=InMemoryExampleDatabase({})
rootdir: /Users/aldcroft/miniconda3/envs/ska3-next/lib/python3.8/site-packages
plugins: remotedata-0.3.3, doctestplus-0.11.2, arraydiff-0.3, anyio-2.2.0, hypothesis-6.29.3, mock-3.6.1, filter-subpackage-0.1.1, openfiles-0.5.0, astropy-header-0.1.2, cov-3.0.0
collected 4 items
...
As an aside, none of our tests use hypothesis
but it ended up getting installed in the environment as a dependency of some other 3rd party package.