[Django] #19941: Make running django's test suite easier

11 views
Skip to first unread message

Django

unread,
Feb 28, 2013, 5:35:14 AM2/28/13
to django-...@googlegroups.com
#19941: Make running django's test suite easier
------------------------------------------------+------------------------
Reporter: akaariai | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Testing framework | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
Two suggested changes to tests/runtests.py:
1. Automatically use tests/../django as the Django version.
2. If no other settings given (either through --settings or
DJANGO_SETTINGS_MODULE) then use test_sqlite as settings

Both of the above changes are available from:
https://github.com/akaariai/django/compare/test_auto_settings

The first item raises a question: is there some use case where one wants
to run tests against *different* django version? To me it seems one
wouldn't want to do this, the tests are tied to specific django version.

I can't see any drawback by doing the second item.

--
Ticket URL: <https://code.djangoproject.com/ticket/19941>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 28, 2013, 5:40:40 AM2/28/13
to django-...@googlegroups.com
#19941: Make running django's test suite easier
--------------------------------------+------------------------------------

Reporter: akaariai | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by apollo13):

* stage: Unreviewed => Accepted


Comment:

I fully agree with 1. and 2. -- I am against supporting other Django
versions.

--
Ticket URL: <https://code.djangoproject.com/ticket/19941#comment:1>

Django

unread,
Feb 28, 2013, 5:53:54 AM2/28/13
to django-...@googlegroups.com
#19941: Make running django's test suite easier
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody
Type: | Status: new
Cleanup/optimization | Version: master
Component: Testing framework | Resolution:
Severity: Normal | Triage Stage: Ready for
Keywords: | checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* stage: Accepted => Ready for checkin


Comment:

LGTM, with the caveat that the long term goal is to get rid of
runtests.py, not extend it...

--
Ticket URL: <https://code.djangoproject.com/ticket/19941#comment:2>

Django

unread,
Feb 28, 2013, 5:54:14 AM2/28/13
to django-...@googlegroups.com
#19941: Make running django's test suite easier
--------------------------------------+------------------------------------

Reporter: akaariai | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by aaugustin):

* needs_docs: 0 => 1
* stage: Ready for checkin => Accepted


Comment:

Not RFC yet in fact :)

--
Ticket URL: <https://code.djangoproject.com/ticket/19941#comment:3>

Django

unread,
Jul 12, 2013, 11:53:39 AM7/12/13
to django-...@googlegroups.com
#19941: Make running django's test suite easier
--------------------------------------+------------------------------------

Reporter: akaariai | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timo):

* cc: timograham@… (added)
* needs_docs: 1 => 0


Comment:

[https://github.com/django/django/pull/1352 PR] with update docs.

--
Ticket URL: <https://code.djangoproject.com/ticket/19941#comment:4>

Django

unread,
Jul 15, 2013, 7:08:07 AM7/15/13
to django-...@googlegroups.com
#19941: Make running django's test suite easier
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody

Type: | Status: new
Cleanup/optimization | Version: master
Component: Testing framework | Resolution:
Severity: Normal | Triage Stage: Ready for
Keywords: | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by loic84):

* stage: Accepted => Ready for checkin


Comment:

Looks good to me.

--
Ticket URL: <https://code.djangoproject.com/ticket/19941#comment:5>

Django

unread,
Jul 15, 2013, 7:41:10 AM7/15/13
to django-...@googlegroups.com
#19941: Make running django's test suite easier
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody

Type: | Status: new
Cleanup/optimization | Version: master
Component: Testing framework | Resolution:
Severity: Normal | Triage Stage: Ready for
Keywords: | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by timo):

I'm unsure why `import django` is needed? Also the comment in the
docstring of `upath` references a "try-except of import django" which
isn't present.

--
Ticket URL: <https://code.djangoproject.com/ticket/19941#comment:6>

Django

unread,
Jul 15, 2013, 12:37:39 PM7/15/13
to django-...@googlegroups.com
#19941: Make running django's test suite easier
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody

Type: | Status: new
Cleanup/optimization | Version: master
Component: Testing framework | Resolution:
Severity: Normal | Triage Stage: Ready for
Keywords: | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by loic84):

I spotted the `import django` and I assumed it was meant as an `assert`.

In light of the docstring, maybe the idea was to provide a helpful error
message?

--
Ticket URL: <https://code.djangoproject.com/ticket/19941#comment:7>

Django

unread,
Jul 24, 2013, 7:33:33 AM7/24/13
to django-...@googlegroups.com
#19941: Make running django's test suite easier
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody
Type: | Status: closed
Cleanup/optimization | Version: master
Component: Testing framework | Resolution: fixed

Severity: Normal | Triage Stage: Ready for
Keywords: | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"b2314d9e1e08749f2c05151f9cd44520d2b3a03a"]:
{{{
#!CommitTicketReference repository=""
revision="b2314d9e1e08749f2c05151f9cd44520d2b3a03a"
Fixed #19941 -- Modified runtests.py to make running the tests easier.

1. Automatically use tests/../django as the Django version.

2. If settings aren't provided through --settings or
DJANGO_SETTINGS_MODULE)
then use test_sqlite.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/19941#comment:8>

Django

unread,
Sep 23, 2013, 7:41:11 AM9/23/13
to django-...@googlegroups.com
#19941: Make running django's test suite easier
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody
Type: | Status: new

Cleanup/optimization | Version: master
Component: Testing framework | Resolution:
Severity: Normal | Triage Stage: Ready for
Keywords: | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by jezdez):

* status: closed => new
* resolution: fixed =>


Comment:

Reopening the sys.path.insert call makes the test setup differ from
standard installation procedures. We've for a long time tried hard to move
away from modifying the sys.path.

As a background, by mangling the sys.path we risk missing import errors
that happen when Django is installed with tools like pip. Instead we
should promote the use of ``pip install -e path/to/django`` when
developing Django.

--
Ticket URL: <https://code.djangoproject.com/ticket/19941#comment:9>

Django

unread,
Sep 23, 2013, 8:06:38 AM9/23/13
to django-...@googlegroups.com
#19941: Make running django's test suite easier
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody

Type: | Status: new
Cleanup/optimization | Version: master
Component: Testing framework | Resolution:
Severity: Normal | Triage Stage: Ready for
Keywords: | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by apollo13):

After discussing this a bit more with jezdez in IRC we came to the
following conclusion:
* `pip install -e .` isn't perfect (in the sense that it doesn't mimic a
sdist install by 100%) but still better than `sys.path` hacks.
* drop `sys.path` hacks again.
* Update the documentation to note `pip install -e` and `PYTHONPATH=..`
alternatives.
* Output something like `print("Testing against Django installed in '%s'"
% django.__file__)` to the console, to allow easier debugging.

--
Ticket URL: <https://code.djangoproject.com/ticket/19941#comment:10>

Django

unread,
Sep 23, 2013, 8:06:49 AM9/23/13
to django-...@googlegroups.com
#19941: Make running django's test suite easier
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody

Type: | Status: new
Cleanup/optimization | Version: master
Component: Testing framework | Resolution:
Severity: Normal | Triage Stage: Ready for
Keywords: | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by apollo13):

* cc: apollo13 (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/19941#comment:11>

Django

unread,
Sep 23, 2013, 10:37:53 AM9/23/13
to django-...@googlegroups.com
#19941: Make running django's test suite easier
--------------------------------------+------------------------------------

Reporter: akaariai | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by akaariai):

* has_patch: 1 => 0


* stage: Ready for checkin => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/19941#comment:12>

Django

unread,
Oct 22, 2013, 10:56:13 AM10/22/13
to django-...@googlegroups.com
#19941: Make running django's test suite easier
--------------------------------------+------------------------------------

Reporter: akaariai | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timo):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/1793 Pull request] with changes
proposed above.

--
Ticket URL: <https://code.djangoproject.com/ticket/19941#comment:13>

Django

unread,
Oct 23, 2013, 6:27:40 PM10/23/13
to django-...@googlegroups.com
#19941: Make running django's test suite easier
--------------------------------------+------------------------------------
Reporter: akaariai | Owner: nobody
Type: Cleanup/optimization | Status: closed

Component: Testing framework | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"c573d6de173c0e6743473081cde786e749641a48"]:
{{{
#!CommitTicketReference repository=""
revision="c573d6de173c0e6743473081cde786e749641a48"
Fixed #19941 -- Removed sys.path hack when running the test suite.

Thanks jezdez for the suggestion.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/19941#comment:14>

Reply all
Reply to author
Forward
0 new messages