diff --git a/test/unit/common/middleware/test_xprofile.py b/test/unit/common/middleware/test_xprofile.py index 7296f69211..720a722311 100644 --- a/test/unit/common/middleware/test_xprofile.py +++ b/test/unit/common/middleware/test_xprofile.py @@ -458,17 +458,17 @@ class Test_html_viewer(unittest.TestCase): self.log_files) def test_format_source_code(self): - nfl_os = '%s:%d(%s)' % (os.__file__[:-1], 136, 'makedirs') - self.assertTrue('makedirs' in self.viewer.format_source_code(nfl_os)) - self.assertFalse('makedirsXYZ' in - self.viewer.format_source_code(nfl_os)) - nfl_illegal = '%s:136(makedirs)' % os.__file__ - self.assertTrue(_('The file type are forbidden to access!') in - self.viewer.format_source_code(nfl_illegal)) - nfl_not_exist = '%s.py:136(makedirs)' % os.__file__ - expected_msg = _('Can not access the file %s.') % os.__file__ - self.assertTrue(expected_msg in - self.viewer.format_source_code(nfl_not_exist)) + osfile = os.__file__.rstrip('c') + nfl_os = '%s:%d(%s)' % (osfile, 136, 'makedirs') + self.assertIn('makedirs', self.viewer.format_source_code(nfl_os)) + self.assertNotIn('makedirsXYZ', self.viewer.format_source_code(nfl_os)) + nfl_illegal = '%sc:136(makedirs)' % osfile + self.assertIn(_('The file type are forbidden to access!'), + self.viewer.format_source_code(nfl_illegal)) + nfl_not_exist = '%s.py:136(makedirs)' % osfile + expected_msg = _('Can not access the file %s.py.') % osfile + self.assertIn(expected_msg, + self.viewer.format_source_code(nfl_not_exist)) class TestStats2(unittest.TestCase): diff --git a/tox.ini b/tox.ini index 3d8d6d9569..f016316c49 100644 --- a/tox.ini +++ b/tox.ini @@ -12,7 +12,10 @@ setenv = VIRTUAL_ENV={envdir} deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt -commands = nosetests {posargs:test/unit} +commands = find . -type f -name "*.py[c|o]" -delete + find . -type d -name "__pycache__" -delete + nosetests {posargs:test/unit} +whitelist_externals = find passenv = SWIFT_* *_proxy [testenv:cover]