Commit 3877c32
Add real RPM fixtures and rewrite RPM-reading tests to use them
Replace the heavily-patched MockRPMHeader approach in test_rpm_reading.py
and test_rpm_checking.py with actual RPM files built from minimal spec files.
The mock approach was fragile in two ways that the reviewer flagged:
- test_skip_source_rpm only passed because the mock hardcoded arch='src',
but real SRPMs have arch='noarch' — the test was not testing real behaviour.
- Every test carried 18 patch() calls that coupled tests to implementation
details (which constants the code reads, whether it uses bytes or str, etc.).
New layout:
tests/fixtures/rpms/
specs/ - five spec files, one per test scenario
rebuild.sh - regenerate RPMs from specs (requires rpmbuild)
*.noarch.rpm - six pre-built binary RPMs
*.src.rpm - one pre-built source RPM
Packages (all noarch, no dist tag for cross-Fedora stability):
revdeptest-foo 1.0 simple package, no epoch
revdeptest-bar 1.0 different SRPM (for mixed-SRPM error test)
revdeptest-bundled 1.0 has bundled(libfoo) and bundled(libbar) provides
revdeptest-multi 1.0 main package with a subpackage (same SRPM)
revdeptest-multi-sub 1.0 subpackage of revdeptest-multi
revdeptest-epoch 9.1.0 Epoch: 1 package
test_rpm_reading.py now imports nothing from unittest.mock and carries no
rpm-module patches. It passes real paths to read_rpm_provides() and asserts
on the real header values returned by the rpm library.
test_rpm_checking.py keeps MockBase/MockPackage for the DNF layer (which has
its own test coverage) but passes real RPM files into check_rpm_files().
Remove *.spec from .gitignore (added for PyInstaller; not relevant here and
was hiding the new spec files from git).
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>1 parent 83ec79f commit 3877c32
16 files changed
Lines changed: 289 additions & 484 deletions
File tree
- tests
- fixtures/rpms
- specs
- integration
- unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
0 commit comments