I’m not sure why py.test does not add the current directory in the PYTHONPATH itself, but here’s a workaround (to be executed from the root of your repository):
python -m pytest tests/
It works because Python adds the current directory in the PYTHONPATH for you.
Related Contents:
- How to properly assert that an exception gets raised in pytest?
- How to print to console in pytest?
- PATH issue with pytest ‘ImportError: No module named YadaYadaYada’
- pytest: assert almost equal
- How to tell py.test to skip certain directories?
- How to mock a readonly property with mock?
- unittest Vs pytest
- Create and import helper functions in tests without creating packages in test directory using py.test
- How can I assert lists equality with pytest
- Why PyTest is not collecting tests (collected 0 items)?
- How to run unittest discover from “python setup.py test”?
- Ensuring py.test includes the application directory in sys.path
- Testing logging output with pytest
- How to test a function with input call?
- Test discovery failure when tests in different directories are called the same
- How to keep Unit tests and Integrations tests separate in pytest
- Pytest monkeypatch isn’t working on imported function
- How to I display why some tests where skipped while using py.test?
- List available tests with py.test
- Pytest fixture for a class through self not as method argument
- How do I make pytest fixtures work with decorated functions?
- Does pytest parametrized test work with unittest class based tests?
- How do I properly assert that an exception gets raised in pytest?
- How do I print to console in pytest?
- In pytest, what is the use of conftest.py files?
- Logging within pytest tests
- Printing test execution times and pinning down slow tests with py.test
- How to properly use unit-testing’s assertRaises() with NoneType objects? [duplicate]
- How do I disable a test using pytest?
- How to test single file under pytest
- Test if a class is inherited from another [duplicate]
- How to assert that an iterable is not empty on Unittest?
- How do I run tox in a project that has no setup.py?
- KeyError in module ‘threading’ after a successful py.test run
- Non-test methods in a Python TestCase
- Python project directory structure / pytest trouble
- pytest cannot find module [duplicate]
- How to mock.patch a class imported in another module
- Why do assertions in unittest use TestCase.assertEqual not the assert keyword?
- Modifying global variables in Python unittest framework
- In python, is there a good idiom for using context managers in setup/teardown
- Coverage.py warning: No data was collected. (no-data-collected)
- How to supply a mock class method for python unit test?
- isinstance and Mocking
- Is there a convention to distinguish Python integration tests from unit tests?
- Python – object MagicMock can’t be used in ‘await’ expression
- How to mock nested functions?
- How to run tests without installing package?
- Multiple copies of a pytest fixture
- What is the optimal naming convention for test files in Python?