Skip to content

Commit f3d1b07

Browse files
authored
Merge pull request #166 from openzim/installed_tests
Add back a runinstalled marker for ogvjs tests
2 parents 7d49831 + 1760941 commit f3d1b07

File tree

7 files changed

+29
-9
lines changed

7 files changed

+29
-9
lines changed

.github/workflows/Tests.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,13 @@ 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'
4242
uses: codecov/codecov-action@v3
4343
with:
44+
fail_ci_if_error: true
4445
token: ${{ secrets.CODECOV_TOKEN }}
4546

4647
build_python:

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

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ apk add ffmpeg gifsicle libmagic wget libjpeg
5555

5656
# Contribution
5757

58-
This project adheres to openZIM's [Contribution Guidelines](https://github.com/openzim/overview/wiki/Contributing)
58+
This project adheres to openZIM's [Contribution Guidelines](https://github.com/openzim/overview/wiki/Contributing).
59+
60+
This project has implemented openZIM's [Python bootstrap, conventions and policies](https://github.com/openzim/_python-bootstrap/docs/Policy.md) **v1.0.2**.
5961

6062
```shell
6163
pip install hatch

pyproject.toml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["hatchling", "hatch-openzim"]
2+
requires = ["hatchling", "hatch-openzim>=0.2"]
33
build-backend = "hatchling.build"
44

55
[project]
@@ -25,11 +25,10 @@ dynamic = ["authors", "classifiers", "keywords", "license", "version", "urls"]
2525

2626
[tool.hatch.metadata.hooks.openzim-metadata]
2727
kind = "scraper"
28-
# not yet supported in hatch-openzim 0.1
29-
# additional-classifiers = [
30-
# "Development Status :: 5 - Production/Stable",
31-
# "Intended Audience :: Developers",
32-
# ]
28+
additional-classifiers = [
29+
"Development Status :: 5 - Production/Stable",
30+
"Intended Audience :: Developers",
31+
]
3332

3433
[project.optional-dependencies]
3534
scripts = [

tasks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def report_cov(ctx: Context, *, html: bool = False):
2424
"""report coverage"""
2525
ctx.run("coverage combine", warn=True, pty=use_pty)
2626
ctx.run("coverage report --show-missing", pty=use_pty)
27+
ctx.run("coverage xml", pty=use_pty)
2728
if html:
2829
ctx.run("coverage html", pty=use_pty)
2930

@@ -92,7 +93,7 @@ def fix_black(ctx: Context, args: str = "."):
9293
def fix_ruff(ctx: Context, args: str = "."):
9394
"""fix all ruff rules"""
9495
args = args or "." # needed for hatch script
95-
ctx.run(f"ruff --fix {args}", pty=use_pty)
96+
ctx.run(f"ruff check --fix {args}", pty=use_pty)
9697

9798

9899
@task(

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)