➤ 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.
* 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>
* 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>
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>
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>
* 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>
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>