Code

Opened 5 years ago

Closed 3 years ago

#11627 closed New feature (duplicate)

Allow users to run individual test suites using manage.py

Reported by: Manoj Govindan <egmanoj@…> Owned by: gruszczy
Component: Testing framework Version: master
Severity: Normal Keywords:
Cc: egmanoj@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX:

Description

Django recognizes unit tests grouped into test suites (unittest.TestSuite instances). However users cannot run individual test suites using manage.py. Allow users to run individual test suites.

Something like this:

python ./manage.py test my_app.feature_foo_test_suite

Attachments (2)

test_suite.1.diff (2.4 KB) - added by gruszczy 5 years ago.
Early version of using test suites in tests
test_suite.3.diff (2.4 KB) - added by gruszczy 5 years ago.
better patch

Download all attachments as: .zip

Change History (11)

comment:1 Changed 5 years ago by Manoj Govindan <egmanoj@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 follow-up: Changed 5 years ago by mmalone

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

It's already possible to run individual test cases or test methods via the manage.py command. See http://docs.djangoproject.com/en/dev/topics/testing/#id1

comment:3 in reply to: ↑ 2 Changed 5 years ago by Manoj Govindan <egmanoj@…>

  • Resolution invalid deleted
  • Status changed from closed to reopened

Replying to mmalone:

It's already possible to run individual test cases or test methods via the manage.py command. See http://docs.djangoproject.com/en/dev/topics/testing/#id1


Yes, users can run individual test cases (unittest.TestCase instances) or test methods. However I was referring to test suites (unittest.TestSuite instances). Django allows users to group their test cases into test suites - the documentation mentions how this can be done and refers users to the Python docs for more details on how to organize test cases. These test suites however cannot be executed separately. Users can only execute individual test cases even though these test cases are grouped into test suites. If say, 10 test cases have been grouped into a suite for a feature and the feature changes, the user has to run the ten test cases separately rather than run a single test suite.

I think the ticket was possibly closed without considering the distinction between test cases and test suites.

comment:4 Changed 5 years ago by mmalone

Fair enough. I mistakenly assumed that since TestSuite implemented the same interface as TestCase Django would allow you to specify a TestSuite as you would a TestCase. But it looks like you're right -- Django calls unittest.TestLoader.loadTestsFromTestCase() from django.test.simple.build_test() which raises an exception if you pass in an instance of TestSuite.

comment:5 Changed 5 years ago by Alex

  • Triage Stage changed from Unreviewed to Accepted

comment:6 Changed 5 years ago by gruszczy

  • Owner changed from nobody to gruszczy
  • Status changed from reopened to new

Changed 5 years ago by gruszczy

Early version of using test suites in tests

comment:7 Changed 5 years ago by gruszczy

  • Patch needs improvement set

I have discussed the case with Russel and I will try to provide a better patch in a few days.

Changed 5 years ago by gruszczy

better patch

comment:8 Changed 3 years ago by julien

  • Severity set to Normal
  • Type set to New feature

comment:9 Changed 3 years ago by ramiro

  • Easy pickings unset
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #6712.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.