Issue #4355
closedPulp unit tests require pulp_file
Description
The pulp unit tests require the pulp_file plugin[0]. This is a problem because we're not running the pulp unit tests against pulp_file PRs so pulp_file changes could break unknowingly break pulp unit tests.
Also, I wonder if unit tests should be requiring a plugin. Unit tests ought to probably mock code instead.
Updated by bmbouter almost 6 years ago
+1 to not having pulpcore or pulpcore-plugin unit tests depend on pulp_file.
Updated by gmbnomis almost 6 years ago
I agree. I did not like using FileContent
when writing the test linked above. The main problem is that there seems to be no 'official' way to create models for testing in Django (see https://code.djangoproject.com/ticket/7835 for example)
In the linked example, we could get away with using the base Content
class. But in general using Content
only:
- won't detect cases that have a missing `.cast()`
- won't help to test code that needs natural keys (stages)
- won't help to test code (like stages) that has to deal with multiple content types
Currently, I don't have a good solution for this problem.
Updated by gmbnomis almost 6 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to gmbnomis
Updated by gmbnomis almost 6 years ago
PR is at https://github.com/pulp/pulp/pull/3855. As said, this does not solve the more generic problem how to write unit tests with multiple non-trivial (content) models.
Added by gmbnomis almost 6 years ago
Added by gmbnomis almost 6 years ago
Revision e7dad14c | View on GitHub
Remove pulp_file dependency from unit tests
Updated by gmbnomis almost 6 years ago
- Status changed from ASSIGNED to MODIFIED
Applied in changeset pulp|e7dad14cecd86bde85cc5b86ca69d3560cc5a2b6.
Updated by bmbouter about 5 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Remove pulp_file dependency from unit tests
closes #4355 https://pulp.plan.io/issues/4355