Skip to content

Commit

Permalink
added conftest and strict markers.
Browse files Browse the repository at this point in the history
  • Loading branch information
cristure committed Nov 4, 2024
1 parent e8c89e1 commit 0080690
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test-localnet-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ jobs:
- name: Test localnet dependent tests
run: |
pytest -m require_localnet multiversx_sdk_cli/tests
12 changes: 12 additions & 0 deletions multiversx_sdk_cli/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import pytest

Check failure on line 1 in multiversx_sdk_cli/tests/conftest.py

View workflow job for this annotation

GitHub Actions / runner / mypy

[mypy] reported by reviewdog 🐶 Cannot find implementation or library stub for module named "pytest" [import-not-found] Raw Output: /home/runner/work/mx-sdk-py-cli/mx-sdk-py-cli/multiversx_sdk_cli/tests/conftest.py:1:1: error: Cannot find implementation or library stub for module named "pytest" [import-not-found]


# function executed right after test items collected but before test run
def pytest_collection_modifyitems(config, items):
if not config.getoption('-m'):
skip_me = pytest.mark.skip(reason="to run marked tests, you need to explicitly run them wiht -m")
for item in items:
if "require_localnet" in item.keywords:
item.add_marker(skip_me)
if "skip_on_winodws" in item.keywords:
item.add_marker(skip_me)
2 changes: 0 additions & 2 deletions multiversx_sdk_cli/tests/test_cli_validators.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import requests
import time
import pytest

from pathlib import Path
Expand Down
4 changes: 2 additions & 2 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[pytest]
markers =
skip_on_windows: marks tests as being skiped when running on windows (deselect with '-m "skip_on_windows"')
skip_on_windows: marks tests as being skipped when running on windows (deselect with '-m "skip_on_windows"')
only: only run a specific test (run using: pytest -m "only")
require_localnet: marks tests that require a localnet (run using: pytest -m require_localnet)
require_localnet: marks tests that require a localnet (select with '-m "require_localnet"')

log_cli = True

0 comments on commit 0080690

Please sign in to comment.