MCPcopy Index your code
hub / github.com/python/cpython / test_extract_with_numeric_owner

Method test_extract_with_numeric_owner

Lib/test/test_tarfile.py:3246–3262  ·  view source on GitHub ↗
(self, mock_geteuid, mock_chmod,
                                        mock_chown)

Source from the content-addressed store, hash-verified

3244 @unittest.mock.patch('os.chmod')
3245 @unittest.mock.patch('os.geteuid')
3246 def test_extract_with_numeric_owner(self, mock_geteuid, mock_chmod,
3247 mock_chown):
3248 with self._setup_test(mock_geteuid) as (tarfl, filename_1, _,
3249 filename_2):
3250 tarfl.extract(filename_1, TEMPDIR, numeric_owner=True,
3251 filter='fully_trusted')
3252 tarfl.extract(filename_2 , TEMPDIR, numeric_owner=True,
3253 filter='fully_trusted')
3254
3255 # convert to filesystem paths
3256 f_filename_1 = os.path.join(TEMPDIR, filename_1)
3257 f_filename_2 = os.path.join(TEMPDIR, filename_2)
3258
3259 mock_chown.assert_has_calls([unittest.mock.call(f_filename_1, 99, 98),
3260 unittest.mock.call(f_filename_2, 88, 87),
3261 ],
3262 any_order=True)
3263
3264 @unittest.mock.patch('os.chown')
3265 @unittest.mock.patch('os.chmod')

Callers

nothing calls this directly

Calls 5

_setup_testMethod · 0.95
assert_has_callsMethod · 0.80
extractMethod · 0.45
joinMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected