Those methods aim to check if some objects are present in the archive.
So no count checks should be performed here as there is no guarantee that
the numbers of objects in the archive will be the same as the number of
objects to test existence.
Details
- Reviewers
ardumont - Group Reviewers
Reviewers - Commits
- rDLDBASEabb75267aaaa: tests.BaseLoaderStorageTest: Remove count checks in assert*Contain methods
Diff Detail
- Repository
- rDLDBASE Generic VCS/Package Loader
- Branch
- tests-assertContain-fix
- Lint
No Linters Available - Unit
No Unit Test Coverage - Build Status
Buildable 4931 Build 6596: tox-on-jenkins Jenkins Build 6595: arc lint + arc unit
Event Timeline
Build is green
See https://jenkins.softwareheritage.org/job/DLDBASE/job/tox/73/ for more details.
as there is no guarantee that the numbers of objects in the archive will be the same as the number of objects to test existence.
Why not?
I think there's value in having some asserts to test object set inclusion rather than object set equality.
If we really want to keep a strict check as well, we could rename them assert<ObjectType>OnlyContains or somesuch.
Consider this test case that I am currently implementing for the npm loader: I want to simulate the multiple visits of a package.
I use a single loader instance instead of creating a new one for each test as I want to test the number of new objects sent
by the loader to the test storage. For the first visit, the test storage is empty so the count checks will pass. But for the second visit,
the test storage is not empty so the count checks will fail.
If we really want to keep a strict check as well, we could rename them assert<ObjectType>OnlyContains or somesuch.
Or simply use the following test combinations:
objects = [...] self.assertCount<ObjectType>(len(objects)) self.assert<ObjectType>Contain(objects)