Project

Profile

Help

Issue #4355

closed

Pulp unit tests require pulp_file

Added by daviddavis almost 6 years ago. Updated about 5 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

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

Actions #1

Updated by daviddavis almost 6 years ago

  • Tags Pulp 3 added
Actions #2

Updated by daviddavis almost 6 years ago

  • Description updated (diff)
Actions #3

Updated by CodeHeeler almost 6 years ago

  • Triaged changed from No to Yes
Actions #4

Updated by bmbouter almost 6 years ago

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

Actions #5

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.

Actions #6

Updated by gmbnomis almost 6 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to gmbnomis
Actions #7

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

Revision e7dad14c | View on GitHub

Remove pulp_file dependency from unit tests

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

Added by gmbnomis almost 6 years ago

Revision e7dad14c | View on GitHub

Remove pulp_file dependency from unit tests

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

Actions #8

Updated by gmbnomis almost 6 years ago

  • Status changed from ASSIGNED to MODIFIED
Actions #9

Updated by daviddavis over 5 years ago

  • Sprint/Milestone set to 3.0.0
Actions #10

Updated by bmbouter over 5 years ago

  • Tags deleted (Pulp 3)
Actions #11

Updated by bmbouter about 5 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF