Skip to content

Commit 53ad6fc

Browse files
committed
Add back a runinstalled marker for ogvjs tests
Before 3.3, there was a --runinstalled switch for tests to disable by default the execution of some tests which were deemed to work only if the package tools were installed. In 3.3.0, we assumed this switch was not necessary anymore before with new Python bootstrap convention, we are always in installed mode. This statement was indeed wrong because some persons are building and testing without using our build chain (e.g. they build and test directly from sdist). This commit adds back the --runinstalled switch for tests and corresponding pytest marker to mark tests that are going to work only if package tools are installed.
1 parent 7d49831 commit 53ad6fc

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

.github/workflows/Tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
pip install -e .[test,scripts]
3636
3737
- name: Run the tests
38-
run: inv coverage --args "--runslow -vvv"
38+
run: inv coverage --args "--runslow --runinstalled -vvv"
3939

4040
- name: Upload coverage report to codecov
4141
if: matrix.python == '3.12'

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Changed
1111
- Simplify type annotations by replacing Union and Optional with pipe character ("|") for improved readability and clarity
1212

13+
### Fixed
14+
- Add back the `--runinstalled` flag for test execution to allow smooth testing on other build chains (#139)
15+
1316
## [3.3.2] - 2024-03-25
1417

1518
### Added

tests/conftest.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,28 @@ def pytest_addoption(parser):
1010
parser.addoption(
1111
"--runslow", action="store_true", default=False, help="run slow tests"
1212
)
13+
parser.addoption(
14+
"--runinstalled",
15+
action="store_true",
16+
default=False,
17+
help="run tests checking for installed features",
18+
)
1319

1420

1521
def pytest_configure(config):
1622
config.addinivalue_line("markers", "slow: mark test as slow to run")
23+
config.addinivalue_line(
24+
"markers", "installed: mark test as testing installed features"
25+
)
1726

1827

1928
def pytest_collection_modifyitems(config, items):
2029
skip_slow = pytest.mark.skip(reason="need --runslow option to run")
30+
skip_installed = pytest.mark.skip(reason="need --runinstalled option to run")
2131

2232
for item in items:
33+
if "installed" in item.keywords and not config.getoption("--runinstalled"):
34+
item.add_marker(skip_installed)
2335
if "slow" in item.keywords and not config.getoption("--runslow"):
2436
item.add_marker(skip_slow)
2537

tests/ogvjs/test_ogvjs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def prepare_ogvjs_folder(tmp_path, videojs_url, ogvjs_url, videojs_ogvjs_url):
4444
tmp_path.joinpath(member).rename(tmp_path.joinpath("videojs-ogvjs.js"))
4545

4646

47+
@pytest.mark.installed
4748
def test_ogvjs_installed_script_missing_param():
4849
# run from installed script to check real conditions
4950
script = subprocess.run(
@@ -63,6 +64,7 @@ def test_ogvjs_from_code_missing_params():
6364

6465

6566
@pytest.mark.slow
67+
@pytest.mark.installed
6668
def test_ogvjs_installed_script_ok(tmp_path, videojs_url, ogvjs_url, videojs_ogvjs_url):
6769
# run from installed script to check real conditions
6870

0 commit comments

Comments
 (0)