Project

Profile

Help

Issue #4355

Pulp unit tests require pulp_file

Added by daviddavis 9 months ago. Updated 6 months ago.

Status:
MODIFIED
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
Severity:
2. Medium
Version:
Platform Release:
Blocks Release:
OS:
Backwards Incompatible:
No
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
QA Contact:
Complexity:
Smash Test:
Verified:
No
Verification Required:
No
Sprint:

Description

The pulp unit tests require the pulp_file plugin0. 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.

[0] https://github.com/pulp/pulp/blob/aaec68dad9f977cb71afe6efddf99daea6f0ffd3/pulpcore/tests/unit/content/test_handler.py#L9

Associated revisions

Revision e7dad14c View on GitHub
Added by gmbnomis 8 months ago

Remove pulp_file dependency from unit tests

closes #4355
https://pulp.plan.io/issues/4355

Revision e7dad14c View on GitHub
Added by gmbnomis 8 months ago

Remove pulp_file dependency from unit tests

closes #4355
https://pulp.plan.io/issues/4355

History

#1 Updated by daviddavis 9 months ago

  • Tags Pulp 3 added

#2 Updated by daviddavis 9 months ago

  • Description updated (diff)

#3 Updated by CodeHeeler 9 months ago

  • Triaged changed from No to Yes

#4 Updated by bmbouter 9 months ago

+1 to not having pulpcore or pulpcore-plugin unit tests depend on pulp_file.

#5 Updated by gmbnomis 9 months 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 9 months ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to gmbnomis

#7 Updated by gmbnomis 9 months 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 8 months ago

  • Status changed from ASSIGNED to MODIFIED

#9 Updated by daviddavis 6 months ago

  • Sprint/Milestone set to 3.0

#10 Updated by bmbouter 6 months ago

  • Tags deleted (Pulp 3)

Please register to edit this issue

Also available in: Atom PDF