Opened 3 years ago

Closed 22 months ago

#18670 closed Bug (wontfix)

Tests are loaded from models.py before tests.py, causes false negative

Reported by: Bradley Ayers <bradley.ayers@…> Owned by: nobody
Component: Testing framework Version: master
Severity: Normal Keywords:
Cc: flo@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I have app/models/foo.py, containing a model with app_label set appropriately. I also have app/tests.py containing a test case called foo. When I run manage.py test app.foo, I am greeted with:

ValueError: Test label 'app.foo' does not refer to a test

Change History (9)

comment:1 Changed 3 years ago by SmileyChris

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 3 years ago by SmileyChris

  • Needs tests set
  • Triage Stage changed from Accepted to Ready for checkin

Code looks good, probably should have tests in django/tests/test_runner

comment:3 Changed 3 years ago by SmileyChris

  • Triage Stage changed from Ready for checkin to Accepted

comment:4 Changed 3 years ago by charettes

Where's the code? Missing PR reference?

comment:5 Changed 3 years ago by Bradley Ayers <bradley.ayers@…>

comment:6 Changed 2 years ago by fhahn

  • Cc flo@… added
  • Has patch set
  • Needs tests unset
  • Version changed from 1.4 to master

I've added a test to Bradley's patch and created a new pull request: https://github.com/django/django/pull/849

comment:7 Changed 2 years ago by aaugustin

Related: #17366

comment:8 Changed 22 months ago by carljm

This will be rendered irrelevant by #17365, which doesn't load tests from models.py at all, and deprecates the code changed in this patch.

comment:9 Changed 22 months ago by carljm

  • Resolution set to wontfix
  • Status changed from new to closed

Closing wontfix, as the new test runner merged in #17365 does not support tests in models.py, and the old runner is deprecated.

Note: See TracTickets for help on using tickets.
Back to Top