- use pytest instead of unittest.TestCase plumbing
- extract data from the TestStorageData into a data storage_data module; this module also provide a simple helper StorageData class that mimics the original class (access by attributes),
- implement a series of pytest fixtures for these storage specific tests,
- get rid of most hypothesis-based tests.
Details
Diff Detail
- Repository
- rDSTO Storage manager
- Branch
- tests-refactorings
- Lint
Lint Skipped - Unit
Unit Tests Skipped - Build Status
Buildable 8366 Build 12112: tox-on-jenkins Jenkins Build 12111: arc lint + arc unit
Event Timeline
swh/storage/tests/conftest.py | ||
---|---|---|
41 | 'memory' (we fixed it together ;) also olasd migrated the existing entries in storage recently. |
Build has FAILED
Link to build: https://jenkins.softwareheritage.org/job/DSTO/job/tox/695/
See console output for more information: https://jenkins.softwareheritage.org/job/DSTO/job/tox/695/console
Build has FAILED
Link to build: https://jenkins.softwareheritage.org/job/DSTO/job/tox/696/
See console output for more information: https://jenkins.softwareheritage.org/job/DSTO/job/tox/696/console
also xfail test_snapshot (until it has been ported to pytest/pytest_postgresql)
in D2117
Build has FAILED
Link to build: https://jenkins.softwareheritage.org/job/DSTO/job/tox/697/
See console output for more information: https://jenkins.softwareheritage.org/job/DSTO/job/tox/697/console
Build has FAILED
Link to build: https://jenkins.softwareheritage.org/job/DSTO/job/tox/698/
See console output for more information: https://jenkins.softwareheritage.org/job/DSTO/job/tox/698/console
Build is green
See https://jenkins.softwareheritage.org/job/DSTO/job/tox/705/ for more details.
Build is green
See https://jenkins.softwareheritage.org/job/DSTO/job/tox/706/ for more details.
swh/storage/tests/conftest.py | ||
---|---|---|
91–95 | well, I would have expected a comment about the fact there is no comment in this code stating that this function is stolen from pytest-postgresql ;-), and explaining why it is needed. | |
tox.ini | ||
28–35 | this chunk could be moved in D2095 I guess. I removed it since I gradually drop support for ENABLE_ORIGIN_IDS in tests. |
tox.ini | ||
---|---|---|
28–35 | py3-no-origin-ids runs tests for the new behavior. Now tox only runs tests for the old behavior. |
Build is green
See https://jenkins.softwareheritage.org/job/DSTO/job/tox/707/ for more details.
add some comment in conftest to explain a bit the postgres stuff
and add sha1_git as unicity key for the hypothesis based gen_contents
helper function.
swh/storage/tests/conftest.py | ||
---|---|---|
49–60 | I do prefer gen_xxx since it's a function that generates these objects. xxx_lists seems less clear to me. |
Build is green
See https://jenkins.softwareheritage.org/job/DSTO/job/tox/708/ for more details.
swh/storage/tests/conftest.py | ||
---|---|---|
49–60 | but it doesn't follow Hypothesis' naming convention. | |
63–76 | If we're going with the gen_ prefix, then these functions should have it too. And swh_origins is way too different from swh_contents to have such a close name. | |
73 | why 20? using these many origins even for tests that won't use it wil make Hypothesis explore much more space than needed. |
swh/storage/tests/conftest.py | ||
---|---|---|
73 | Have you noticed I do not use hypothesis for exploring anything here? I'm using it as an easy way of generating (fixed-size) datasets. But, it would make sense to use the gen_origins() in this fixture, instead of reimplementing it. |
swh/storage/tests/conftest.py | ||
---|---|---|
17 | Don't we want a fixture sqldir similar to the datadir we introduced in swh-core for the sql files? | |
37 | Isn't a memory objstorage enough? | |
73 |
Yes, i don't get why you did not do it since it's the same code ;) |
swh/storage/tests/conftest.py | ||
---|---|---|
81 | I don't even know what's the DBJanitor you are talking about ;) |
fix definition and usage of swh_contents and swh_origins fixtures
also add a revision that use an in memory obj storage in swh_storage fixture
Build is green
See https://jenkins.softwareheritage.org/job/DSTO/job/tox/709/ for more details.
revert usage for self._test_origin_ids and use_url to fix py3-no-origin-ids
also replace boolean hypothesis strategy by pytest.mark.parametrize, so we do
not need to reset the storage in these tests (since the test is truly
executed twice).
Build is green
See https://jenkins.softwareheritage.org/job/DSTO/job/tox/718/ for more details.
Build is green
See https://jenkins.softwareheritage.org/job/DSTO/job/tox/728/ for more details.