Commit 23bd99a9 authored by Simon Chabot's avatar Simon Chabot
Browse files

fix(tests): test_chmod checks whether the permissions are the same as the source file

test_chmod used to check that permission are 644, but this is not what is done
in the `process_resource` method. This function sets the permissions to the same
as the source file.

As a consequence, depending on your configuration (default umask for instance),
you may end up with the expected 644 permissions or… something else. (666 on our
gitlab-runner for instance).

To make the test consistent with what is done in the function, and consistent
with the initial purpose of this test [0], let's simply check that the
permissions of the source file and the compiled file are the same.

If it appears that this is not enough, a solution could be to enforce 644
permissions in the `process_resource` method, or give the expected permissions
through parameters.

[0]: https://www.cubicweb.org/ticket/17143773

--HG--
branch : 3.27
parent 3226314d84ba
Pipeline #62156 failed with stages
in 21 minutes and 32 seconds
......@@ -62,8 +62,9 @@ class PropertySheetTC(TestCase):
ps = PropertySheet(self.cachedir, datadir_url='http://cwtest.com')
ps.load(self.data('sheet1.py'))
rdir = ps.process_resource(DATADIR, 'pouet.css')
mode = os.stat(join(rdir, 'pouet.css')).st_mode
self.assertEqual(('%o' % mode)[-4:], '0644')
expected_mode = os.stat(self.data('sheet1.py')).st_mode
got_mode = os.stat(join(rdir, 'pouet.css')).st_mode
self.assertEqual(got_mode, expected_mode)
if __name__ == '__main__':
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment