Project

Profile

Help

Issue #4355

Pulp unit tests require pulp_file

Added by daviddavis over 1 year ago. Updated 6 months ago.

Status:
CLOSED - CURRENTRELEASE
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 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.

[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 over 1 year ago

Remove pulp_file dependency from unit tests

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

Revision e7dad14c View on GitHub
Added by gmbnomis over 1 year ago

Remove pulp_file dependency from unit tests

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

History

#1 Updated by daviddavis over 1 year ago

  • Tags Pulp 3 added

#2 Updated by daviddavis over 1 year ago

  • Description updated (diff)

#3 Updated by CodeHeeler over 1 year ago

  • Triaged changed from No to Yes

#4 Updated by bmbouter over 1 year ago

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

#5 Updated by gmbnomis over 1 year 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 over 1 year ago

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

#7 Updated by gmbnomis over 1 year 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 over 1 year ago

  • Status changed from ASSIGNED to MODIFIED

#9 Updated by daviddavis about 1 year ago

  • Sprint/Milestone set to 3.0.0

#10 Updated by bmbouter about 1 year ago

  • Tags deleted (Pulp 3)

#11 Updated by bmbouter 6 months ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Please register to edit this issue

Also available in: Atom PDF