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 b383e77 commit c2f346b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Changelog
``pinnwand`` is Python pastebin software that tried to keep it simple but got
a little more complex.

v1.6.1 (unreleased)
*******************
* Conditionally discover e2e testcases only when playwright is available in
the environment. Closes #284.

v1.6.0 (20241101)
*******************
* Added a browser test suite by nekhvoya_.
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 c2f346b

Please sign in to comment.