Message6063
Greetings,
Sorry for the late reply. I suspended the subject because of thinking
that I'm doing something wrong again.
I run test as:
./run_tests.py -k testserve_static_files test/test_cgi.py
and get error:
AssertionError: '/devel/hibcore/src/_test_cgi_form/html/issue.index.html' != '_test_cgi_form/html/issue.index.html'
I have slightly different code base so this may be not an issue.
I note the subject because I guess this is related to parts that I didn't
touch. I did look in code and wondering how relative path can be expected here.
The serve_static_file has the following assignments:
filename = os.path.normpath(os.path.join(p, file))
where p is self.instance.config['TEMPLATES'] or self.instance.config['STATIC_FILES']
'TEMPLATES' and 'STATIC_FILES' are FilePathOption
(MultiFilePathOption) object. Both options return an absolute path
like this:
if _val and not os.path.isabs(_val):
_val = os.path.join(self.config["HOME"], _val)
So I don't understand how 'filename' can be a relative path.
But may be I've touched some code and forget.
> John Rouillard added the comment:
> Hi Anthony:
> In message <489608269.20171025170504@inbox.ru>,
> Anthony writes:
>>I have a question about test case failure. Why do test expect relative
>>path but not absolute?
>>
>>test.test_cgi.FormTestCase testMethod=testserve_static_files>
>>
>> def testserve_static_files(self):
>> ...
>>
>> # TEMPLATES dir is searched by default. So this file exists.
>> # Check the returned values.
>> cl.serve_static_file("issue.index.html")
>> self.assertEquals(output[0][1], "text/html")
>>> self.assertEquals(output[0][3], "_test_cgi_form/html/issue.index.html")
>>E AssertionError: '/devel/hibcore/src/test/_test_cgi_form/html/issue.index.html' !=
>>'_test_cgi_form/html/issue.index.html'
>>
>>test_cgi.py:1411: AssertionError
> How did you generate this error? Running:
> ./run_tests.py -k testserve_static_files test/test_cgi.py
> $PWD/run_tests.py -k testserve_static_files test/test_cgi.py
> $PWD/roundup/run_tests.py -k testserve_static_files roundup/test/test_cgi.py
> and
> ./run_tests.py -k testserve_static_files $PWD/test/test_cgi.py
> all work as expected for me. They generate paths relative to the
> current working directory where the test directory is generated.
> I expect the relative paths to be repeatable while an absolute path
> would not repeatable (it would depend on the absolute location of the
> directory where the test was run).
> ----------
> nosy: +rouilj
> ________________________________________________
> Roundup tracker <issues@roundup-tracker.org>
> <http://issues.roundup-tracker.org/issue2550956>
> ________________________________________________ |
|
Date |
User |
Action |
Args |
2018-02-12 15:51:24 | antmail | set | recipients:
+ antmail, ber, rouilj |
2018-02-12 15:51:24 | antmail | link | issue2550956 messages |
2018-02-12 15:51:23 | antmail | create | |
|