Skip to content
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

pytest_sessionstart not run in custom test directories #10987

Closed
padix-key opened this issue May 11, 2023 · 1 comment · Fixed by #10988
Closed

pytest_sessionstart not run in custom test directories #10987

padix-key opened this issue May 11, 2023 · 1 comment · Fixed by #10988

Comments

@padix-key
Copy link

When using a custom test directory, other than tests/ the pytest_sessionstart hook (or the maybe also the entire conftest.py) is not run. The issue appeared at pytest version 7.3.1 under Windows 10.

I created a minimum working example that shows the problem at https://github.com/padix-key/pytest-issue. When the tests folder some_path is renamed to tests pytest_sessionstart()` is sucessfully run, indicated by the raised Exception. Otherwise it is not run.

nicoddemus added a commit to nicoddemus/pytest that referenced this issue May 11, 2023
The 'testpaths' option is meant to be identical to execute
pytest passing the 'testpaths' directories explicitly.

Fix pytest-dev#10987
@nicoddemus
Copy link
Member

Thanks for the reproducer, it was really helpful! Opened #10988 with a fix.

nicoddemus added a commit to nicoddemus/pytest that referenced this issue May 11, 2023
The 'testpaths' option is meant to be identical to execute
pytest passing the 'testpaths' directories explicitly.

Fix pytest-dev#10987
nicoddemus added a commit to nicoddemus/pytest that referenced this issue May 11, 2023
The 'testpaths' option is meant to be identical to execute
pytest passing the 'testpaths' directories explicitly.

Fix pytest-dev#10987
nicoddemus added a commit to nicoddemus/pytest that referenced this issue May 11, 2023
The 'testpaths' option is meant to be identical to execute
pytest passing the 'testpaths' directories explicitly.

Fix pytest-dev#10987
nicoddemus added a commit to nicoddemus/pytest that referenced this issue May 11, 2023
The 'testpaths' option is meant to be identical to execute
pytest passing the 'testpaths' directories explicitly.

Fix pytest-dev#10987
nicoddemus added a commit to nicoddemus/pytest that referenced this issue May 12, 2023
The 'testpaths' option is meant to be identical to execute
pytest passing the 'testpaths' directories explicitly.

Fix pytest-dev#10987
nicoddemus added a commit to nicoddemus/pytest that referenced this issue May 12, 2023
The 'testpaths' option is meant to be identical to execute
pytest passing the 'testpaths' directories explicitly.

Fix pytest-dev#10987
nicoddemus added a commit to nicoddemus/pytest that referenced this issue May 12, 2023
The 'testpaths' option is meant to be identical to execute
pytest passing the 'testpaths' directories explicitly.

Fix pytest-dev#10987
jjbayer added a commit to getsentry/relay that referenced this issue Jun 12, 2023
Our CI uses an unpinned version of `pytest`. pytest 7.3.2 includes the
following fix:

> [#10987](pytest-dev/pytest#10987):
[testpaths](https://docs.pytest.org/en/latest/reference/reference.html#confval-testpaths)
is now honored to load root conftests.

([changelog](https://docs.pytest.org/en/latest/changelog.html))

In our case, this led to an import error, because the CI job running
tests in `py/` does not install the requirements needed to configure our
python integration tests. Moving the pytest.ini file to `tests/` fixes
the issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants