@@ -187,3 +187,40 @@ def test_simulate_version_change_already_broken_package(self, already_broken_bas
187187 for conflict in new_pkg_conflicts :
188188 assert conflict ['already_broken' ] is False
189189 assert 'python3dist(library) < 5.0' in conflict ['failed_constraint' ]
190+
191+ def test_simulate_version_change_inherits_epoch (self , epoch_package_base ):
192+ """Test that new version without epoch inherits epoch from current package."""
193+ checker = FedoraRevDepChecker (verbose = False , base = epoch_package_base )
194+
195+ # Current package is 1:8.0.0, upgrading to 9.0.0 (without epoch)
196+ # should be interpreted as 1:9.0.0, not 0:9.0.0
197+ # reverse-dep requires >= 1:8.0.0, so 1:9.0.0 should satisfy it
198+ results = checker .simulate_version_change ('sphinx' , '9.0.0' )
199+
200+ assert 'error' not in results
201+ # The new_version should be transformed to include epoch
202+ assert results ['new_version' ] == '1:9.0.0'
203+
204+ # Should have no conflicts (1:9.0.0 >= 1:8.0.0)
205+ assert len (results ['conflicts' ]) == 0
206+
207+ def test_simulate_version_change_epoch_only_for_rpm_provides (self , epoch_with_dist_provides_base ):
208+ """Test that epoch is only used for RPM provides, not for dist provides."""
209+ checker = FedoraRevDepChecker (verbose = False , base = epoch_with_dist_provides_base )
210+
211+ # Current package is 1:8.0.0 with both RPM and dist provides
212+ # Upgrading to 9.1.0 should:
213+ # - Use 1:9.1.0 for RPM package provides (with epoch)
214+ # - Use 9.1.0 for dist provides (without epoch)
215+ # reverse-dep-rpm requires python3-sphinx >= 1:8.0.0 (should be satisfied)
216+ # reverse-dep-dist requires python3dist(sphinx) < 10~~ (should be satisfied)
217+ results = checker .simulate_version_change ('sphinx' , '9.1.0' )
218+
219+ assert 'error' not in results
220+ assert results ['new_version' ] == '1:9.1.0'
221+
222+ # Should have no conflicts
223+ # Both requirements should be satisfied:
224+ # - 1:9.1.0 >= 1:8.0.0 (True)
225+ # - 9.1.0 < 10~~ (True)
226+ assert len (results ['conflicts' ]) == 0
0 commit comments