Hi Chris,
On May 18, 2013, at 8:34 AM, Chris Wilson <[email protected]> wrote:
> On Sat, 18 May 2013, Chris Wilson wrote:
>
>> I think Travis is unhappy about something in this commit. Any ideas?
>>
>> ======================================================================
>> ERROR: test_file_path (test_runner.test_discover_runner.DiscoverRunnerTest)
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>> File
>> "/home/travis/build/aptivate/django/tests/test_runner/test_discover_runner.py",
>> line 65, in test_file_path
>> ["test_discovery_sample/"],
>> File "/home/travis/build/aptivate/django/django/test/runner.py", line 63, in
>> build_suite
>> tests = self.test_loader.loadTestsFromName(label)
>> File "/usr/lib/python2.7/unittest/loader.py", line 91, in loadTestsFromName
>> module = __import__('.'.join(parts_copy))
>> ImportError: Import by filename is not supported.
>>
>> <https://next.travis-ci.org/aptivate/django/jobs/7275360>
>
> It seems to be checking if a file exists, using a relative path, in
> django/test/runner.py:65:
>
> if not os.path.exists(label_as_path):
> tests = self.test_loader.loadTestsFromName(label)
>
> And that will behave differently depending if you run your tests from inside
> the tests directory like this:
>
> ./runtests.py -v2 --settings=test_postgres_nogis test_runner
>
> Or from the parent directory, as Travis currently does, like this:
>
> python -Wall tests/runtests.py --selenium --verbosity 2 \
> --settings=django_settings
>
> I can work around it in Travis by changing working directory before running
> the tests, but is it worth fixing this in the test runner, perhaps using an
> absolute path based on __file__?
I don't think this should be fixed in the test runner itself; in general,
file-path test labels _should_ be interpreted as relative to wherever you are
running the tests from.
But it should be fixed in the
test_runner.test_discover_runner.DiscoverRunnerTest.test_file_path test - that
test apparently needs to isolate itself better by setting the CWD for the
duration of the test, or something similar. Mind filing a bug? I should be able
to take a look soon.
Carl
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.