#22213 closed Bug (worksforme)
Test failure: relative path in resolve_url
Reported by: | afuna | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | 1.6 |
Severity: | Normal | Keywords: | |
Cc: | django@… | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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
Change History (6)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
(please reopen with more details if my previous comment didn't work)
comment:3 by , 11 years ago
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.
comment:4 by , 11 years ago
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?
comment:5 by , 11 years ago
Cc: | added |
---|
To provide some more context to my earlier comment, the user I was referring to was __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.
comment:6 by , 11 years ago
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
.
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.