[Django] #22213: Test failure: relative path in resolve_url

5 views
Skip to first unread message

Django

unread,
Mar 5, 2014, 11:44:55 AM3/5/14
to django-...@googlegroups.com
#22213: Test failure: relative path in resolve_url
-----------------------------------+--------------------
Reporter: afuna | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------
Running against master:

➤ python tests/runtests.py resolve_url.tests.ResolveUrlTests
```
Testing against Django installed in 'code/django/django'
Creating test database for alias 'default'...
Creating test database for alias 'other'...
....E...
{{{
======================================================================
ERROR: test_relative_path (resolve_url.tests.ResolveUrlTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "code/django/tests/resolve_url/tests.py", line 29, in
test_relative_path
self.assertEqual('../', resolve_url('../'))
File "code/django/django/shortcuts/__init__.py", line 151, in
resolve_url
File "code/django/django/core/urlresolvers.py", line 515, in reverse
return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args,
**kwargs))
File "code/django/django/core/urlresolvers.py", line 387, in
_reverse_with_prefix
lookup_view = get_callable(lookup_view, True)
File "code/django/django/utils/lru_cache.py", line 101, in wrapper
result = user_function(*args, **kwds)
File "code/django/django/core/urlresolvers.py", line 96, in get_callable
mod = import_module(mod_name)
File
"python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py",
line 30, in import_module
raise TypeError("relative imports require the 'package' argument")
TypeError: relative imports require the 'package' argument
}}}

Looks to have been introduced in 8251438cb8c1d47779e9fc33cfa84dad9851a774

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

Django

unread,
Mar 5, 2014, 11:52:11 AM3/5/14
to django-...@googlegroups.com
#22213: Test failure: relative path in resolve_url
-----------------------------------+--------------------------------------

Reporter: afuna | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by bmispelon):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

Hi,

The test pass on my machine and on our CI server
(http://ci.djangoproject.com/).

Did you make sure to run `git clean -fdx` to get a clean checkout
(warning: this will delete any uncommited change and untracked file in the
repository).
Sometimes, leftover `.pyc` files can make some tests fail and this command
will delete them.

If that still fails, can you give some more details about your
configuration (your OS for example)?

Thanks.

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

Django

unread,
Mar 5, 2014, 3:35:07 PM3/5/14
to django-...@googlegroups.com
#22213: Test failure: relative path in resolve_url
-----------------------------------+--------------------------------------
Reporter: afuna | Owner: nobody
Type: Bug | Status: closed

Component: Testing framework | Version: 1.6
Severity: Normal | Resolution: worksforme
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by bmispelon):

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


Comment:

(please reopen with more details if my previous comment didn't work)

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

Django

unread,
Mar 5, 2014, 5:10:48 PM3/5/14
to django-...@googlegroups.com
#22213: Test failure: relative path in resolve_url
-----------------------------------+--------------------------------------
Reporter: afuna | Owner: nobody
Type: Bug | Status: closed

Component: Testing framework | Version: 1.6
Severity: Normal | Resolution: worksforme
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Comment (by Keryn Knight <django@…>):

To chime in with an anecdotal report: a user on IRC encountered the same
test failure (or similar one raising the same TypeError) recently, but
neither I nor the CI could reproduce the error. That user was running OSX
(as I do), which the above traceback seems to match.

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

Django

unread,
Mar 5, 2014, 5:44:04 PM3/5/14
to django-...@googlegroups.com
#22213: Test failure: relative path in resolve_url
-----------------------------------+--------------------------------------
Reporter: afuna | Owner: nobody
Type: Bug | Status: closed

Component: Testing framework | Version: 1.6
Severity: Normal | Resolution: worksforme
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Comment (by bmispelon):

I noticed that the way the tests are run (`python tests/runtests.py
resolve_url.tests.ResolveUrlTests`) doesn't match what we recommend in
https://docs.djangoproject.com/en/dev/internals/contributing/writing-code
/unit-tests/#quickstart.

Does changing that fix the issue?

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

Django

unread,
Mar 6, 2014, 3:45:39 AM3/6/14
to django-...@googlegroups.com
#22213: Test failure: relative path in resolve_url
-----------------------------------+--------------------------------------
Reporter: afuna | Owner: nobody
Type: Bug | Status: closed

Component: Testing framework | Version: 1.6
Severity: Normal | Resolution: worksforme
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by Keryn Knight <django@…>):

* cc: django@… (added)


Comment:

To provide some more context to my earlier comment, the user I was
referring to was [http://django-irc-logs.com/2014/feb/20/#1473889
__machine on IRC], which I think is the Trac user `mrmachine`. Meanwhile
I've run `python tests/runtests.py resolve_url.tests.ResolveUrlTests` (ie:
the unrecommended way of running it) on OSX 10.8.4 with Python 2.7.6 via
Homebrew and am unable to replicate the error reported.

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

Django

unread,
Mar 6, 2014, 4:05:03 AM3/6/14
to django-...@googlegroups.com
#22213: Test failure: relative path in resolve_url
-----------------------------------+--------------------------------------
Reporter: afuna | Owner: nobody
Type: Bug | Status: closed

Component: Testing framework | Version: 1.6
Severity: Normal | Resolution: worksforme
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Comment (by afuna):

It looks like it was the leftover .pyc files after all, thanks all, and
sorry for the noise!


For further context: `python tests/runtests.py` vs `cd tests; python
runtests.py` didn't seem to have any bearing. I originally ran into the
test failure while running the test suite the normal way, and went to the
toplevel directory so I could run `git bisect`.

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

Reply all
Reply to author
Forward
0 new messages