Skip to content

Commit

Permalink
test: conditional e2e discovery
Browse files Browse the repository at this point in the history
When pytest discovers test files to run it executes the files (or
something like it). This means that imports must be available at that
point in time.

Let's add an import check to `conftest.py` to ignore discovery in the
e2e subdirectory when playwright is not available.

This closes #284.

Signed-off-by: Simon de Vlieger <[email protected]>
  • Loading branch information
supakeen committed Nov 15, 2024
1 parent 8ce9367 commit 5f0e526
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ v1.6.1 (unreleased)
*******************
* Removed the default indentation from pastes. It now only applies to configured
languages again. Opened a public discussion about this behavior.
* Conditionally discover e2e testcases only when playwright is available in
the environment. Closes #284.

v1.6.0 (20241101)
*******************
Expand Down
6 changes: 6 additions & 0 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
from slugify import slugify


try:
import playwright
except ImportError:
collect_ignore = ["e2e/"]


def pytest_addoption(parser):
parser.addoption(
"--e2e",
Expand Down

0 comments on commit 5f0e526

Please sign in to comment.