Opened 7 years ago

Closed 6 years ago

#11627 closed New feature (duplicate)

Allow users to run individual test suites using manage.py

Reported by: Manoj Govindan <egmanoj@…> Owned by: Filip Gruszczyński
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 Filip Gruszczyński 7 years ago.
Early version of using test suites in tests
test_suite.3.diff (2.4 KB) - added by Filip Gruszczyński 7 years ago.
better patch

Download all attachments as: .zip

Change History (11)

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

comment:2 Changed 7 years ago by Michael Malone

Resolution: invalid
Status: newclosed

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 7 years ago by Manoj Govindan <egmanoj@…>

Resolution: invalid
Status: closedreopened

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 7 years ago by Michael Malone

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 7 years ago by Alex Gaynor

Triage Stage: UnreviewedAccepted

comment:6 Changed 7 years ago by Filip Gruszczyński

Owner: changed from nobody to Filip Gruszczyński
Status: reopenednew

Changed 7 years ago by Filip Gruszczyński

Attachment: test_suite.1.diff added

Early version of using test suites in tests

comment:7 Changed 7 years ago by Filip Gruszczyński

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 7 years ago by Filip Gruszczyński

Attachment: test_suite.3.diff added

better patch

comment:8 Changed 6 years ago by Julien Phalip

Severity: Normal
Type: New feature

comment:9 Changed 6 years ago by Ramiro Morales

Easy pickings: unset
Resolution: duplicate
Status: newclosed

Duplicate of #6712.

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