Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a distutils test command #52571

Closed
tarekziade mannequin opened this issue Apr 5, 2010 · 13 comments
Closed

add a distutils test command #52571

tarekziade mannequin opened this issue Apr 5, 2010 · 13 comments
Assignees
Labels
type-feature A feature request or enhancement

Comments

@tarekziade
Copy link
Mannequin

tarekziade mannequin commented Apr 5, 2010

BPO 8324
Nosy @warsaw, @giampaolo, @tarekziade, @merwok, @voidspace

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/tarekziade'
closed_at = <Date 2010-09-07.15:18:51.873>
created_at = <Date 2010-04-05.23:19:32.568>
labels = ['type-feature']
title = 'add a distutils test command'
updated_at = <Date 2010-09-07.15:18:51.850>
user = 'https://github.com/tarekziade'

bugs.python.org fields:

activity = <Date 2010-09-07.15:18:51.850>
actor = 'eric.araujo'
assignee = 'tarek'
closed = True
closed_date = <Date 2010-09-07.15:18:51.873>
closer = 'eric.araujo'
components = ['Distutils2']
creation = <Date 2010-04-05.23:19:32.568>
creator = 'tarek'
dependencies = []
files = []
hgrepos = []
issue_num = 8324
keywords = ['gsoc']
message_count = 13.0
messages = ['102426', '102427', '105362', '105376', '105382', '105383', '105384', '105386', '105389', '105390', '105393', '105418', '115773']
nosy_count = 8.0
nosy_names = ['barry', 'giampaolo.rodola', 'tarek', 'eric.araujo', 'michael.foord', 'konryd', 'meatballhat', 'zubin71']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue8324'
versions = ['Python 2.6', 'Python 2.5', 'Python 3.1', 'Python 2.7', 'Python 3.2']

@tarekziade
Copy link
Mannequin Author

tarekziade mannequin commented Apr 5, 2010

Add a test command in distutils, ala setuptools

@tarekziade tarekziade mannequin self-assigned this Apr 5, 2010
@tarekziade tarekziade mannequin added the type-feature A feature request or enhancement label Apr 5, 2010
@voidspace
Copy link
Contributor

Should default to test discovery if no arguments are supplied.

Valid arguments: "testrunner", "tests" or "testsuite".
Default testrunner is unittest of course. "tests" / "testsuite" to be of the form: "package.module.suitename" (or just "package.module").

@voidspace voidspace changed the title add a test command add a distutils test command Apr 5, 2010
@meatballhat
Copy link
Mannequin

meatballhat mannequin commented May 9, 2010

For what it's worth, I'm trying to adapt the setuptools command of the same name in a feature branch called "mbh/adding-test-command" --> http://bitbucket.org/meatballhat/distutils2/

Not sure how the roundup/<external tracker> split is usually handled, so sorry if I'm doin it wrong :-/

@voidspace
Copy link
Contributor

Adapting the setuptools command is a great way to start of course. Please see my note about using unittest/unittest2 test discovery as a default command if unitest2 is available and no test_suite is specified. I'm very happy to help with this.

@meatballhat
Copy link
Mannequin

meatballhat mannequin commented May 9, 2010

Should I assume that unittest2 is an installation requirement of distutils2, or is it preferable to try using unittest2 and falling back to a custom TestLoader? Sorry if I'm reading too much into this :-/

@merwok
Copy link
Member

merwok commented May 9, 2010

unittest2 is the name of the independent release of the improved unittest package in 2.7’s and 3.2’s stdlib.

@meatballhat
Copy link
Mannequin

meatballhat mannequin commented May 9, 2010

@merwok I know ;-) ... should I assume that it's an installation requirement a la install_requires=['unittest2'], or do::

try:
    load_tests_with_unittest2()
except ImportError:
    load_tests_with_custom_test_loader()

?

@merwok
Copy link
Member

merwok commented May 9, 2010

Not a unittest expert, but I suspect that usual test for features will work:

try:
from unittest.something.discovery import Loader
except ImportError:
from unittest2.something.discovery import Loader

Adding Konrad to nosy, since adding new commands will be his GSoC work.

(Also adjusting versions and removing the gsoc keyword that means “Issue is a good candidate for Google’s Summer of Code”, not “Issue part of an accepted GSoC project”)

@voidspace
Copy link
Contributor

unittest2 is used for distutils2 development, but *not* a required dependency for *using* distutils2 (if I understand correctly(.

Well, if there is no test runner and no test suite specified but the test command is invoked then the steps should probably be something like:

  • If Python version 2.7+ or 3.2+ then use test discovery from unittest
  • If Python version 3.0, 3.1 or 2.6- then attempt to import unittest2 and do test discovery
  • Otherwise do nothing

Test discovery is done with unittest(2).TestLoader.discover(...)

If a specific test runner or suite is provided then distutils2 should use those and need not attempt test discovery (again - my understanding).

So test discovery is a useful default if no test command is configured for a project. We may also want ways to configure that (for example allow a project to have test discovery for its test command but provide a different pattern for finding test files).

@voidspace
Copy link
Contributor

Documentation for unittest.TestLoader.discover(...) is at:

http://docs.python.org/dev/library/unittest.html#unittest.TestLoader.discover

@meatballhat
Copy link
Mannequin

meatballhat mannequin commented May 9, 2010

@mfoord thank you for the clarification! :)

@tarekziade
Copy link
Mannequin Author

tarekziade mannequin commented May 9, 2010

@eric: I asked for the gsoc keyword to make my work easier in bug triage. And as a matter of fact, it means that the issue part of the GSoC.

@merwok
Copy link
Member

merwok commented Sep 7, 2010

Implemented by Konrad and merged into the main repo.

@merwok merwok closed this as completed Sep 7, 2010
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants