Issue #4355
Pulp 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.
Associated revisions
Revision e7dad14c
View on GitHub
Remove pulp_file dependency from unit tests
History
#1
Updated by daviddavis almost 2 years ago
- Tags Pulp 3 added
#2
Updated by daviddavis almost 2 years ago
- Description updated (diff)
#3
Updated by CodeHeeler almost 2 years ago
- Triaged changed from No to Yes
#4
Updated by bmbouter almost 2 years ago
+1 to not having pulpcore or pulpcore-plugin unit tests depend on pulp_file.
#5
Updated by gmbnomis almost 2 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.
#6
Updated by gmbnomis almost 2 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to gmbnomis
#7
Updated by gmbnomis almost 2 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.
#8
Updated by gmbnomis almost 2 years ago
- Status changed from ASSIGNED to MODIFIED
Applied in changeset pulp|e7dad14cecd86bde85cc5b86ca69d3560cc5a2b6.
#9
Updated by daviddavis almost 2 years ago
- Sprint/Milestone set to 3.0.0
#10
Updated by bmbouter over 1 year ago
- Tags deleted (
Pulp 3)
#11
Updated by bmbouter about 1 year ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Please register to edit this issue
Remove pulp_file dependency from unit tests
closes #4355 https://pulp.plan.io/issues/4355