File tree Expand file tree Collapse file tree 5 files changed +57
-0
lines changed
Expand file tree Collapse file tree 5 files changed +57
-0
lines changed Original file line number Diff line number Diff line change 1+ summary:
2+ Functional tests
3+ discover+:
4+ filter: tier:2
5+ prepare:
6+ - how: install
7+ package: xz
8+ - how: shell
9+ script: |
10+ curl -O https://src.fedoraproject.org/lookaside/rpm-specs-latest.tar.xz
11+ tar -xf rpm-specs-latest.tar.xz -C /tmp
Original file line number Diff line number Diff line change 1+ summary:
2+ Functional tests
3+ require:
4+ - python3-pytest
5+ - python3-specfile
6+ - redhat-rpm-config
7+ - rpmautospec-rpm-macros
8+ - "*-srpm-macros"
9+ tag:
10+ - functional
11+ tier: 2
12+ duration: 1h
13+ # running from the "tests" directory prevents pytest from processing "tests/functional/conftest.py"
14+ path: /
15+ test: python3 -m pytest --verbose --specdir=/tmp/rpm-specs tests/functional
Original file line number Diff line number Diff line change 1+ # Copyright Contributors to the Packit project.
2+ # SPDX-License-Identifier: MIT
Original file line number Diff line number Diff line change 1+ # Copyright Contributors to the Packit project.
2+ # SPDX-License-Identifier: MIT
3+
4+ from pathlib import Path
5+
6+
7+ def pytest_addoption (parser ):
8+ parser .addoption (
9+ "--specdir" ,
10+ action = "store" ,
11+ default = None ,
12+ help = "path to a directory containing spec files" ,
13+ )
14+
15+
16+ def pytest_generate_tests (metafunc ):
17+ if "spec_path" in metafunc .fixturenames :
18+ specdir = metafunc .config .getoption ("specdir" )
19+ specs = list (Path (specdir ).glob ("*.spec" )) if specdir else []
20+ metafunc .parametrize ("spec_path" , specs , ids = lambda p : p .name )
Original file line number Diff line number Diff line change 1+ # Copyright Contributors to the Packit project.
2+ # SPDX-License-Identifier: MIT
3+
4+ from specfile import Specfile
5+
6+
7+ def test_parse (spec_path ):
8+ spec = Specfile (spec_path , force_parse = True )
9+ assert spec .expanded_version
You can’t perform that action at this time.
0 commit comments