Bug 1472199 - [mozbuild] Remove unittest dependency from test_pythonutil.py and narrow to tests module; r?ahal
The test checks the modules imported, which means it will fail if we import mozbuild.base to determine the topsrcdir. Rather than include the additional modules, which may change in the future, I have narrowed the scope of the test to the mozbuild/tests module.
MozReview-Commit-ID: GiaPzp19adE
--- a/python/mozbuild/mozbuild/test/test_pythonutil.py
+++ b/python/mozbuild/mozbuild/test/test_pythonutil.py
@@ -1,24 +1,20 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from mozbuild.pythonutil import iter_modules_in_path
from mozunit import main
import os
-import unittest
-class TestIterModules(unittest.TestCase):
- def test_iter_modules_in_path(self):
- mozbuild_path = os.path.normcase(os.path.dirname(os.path.dirname(__file__)))
- paths = list(iter_modules_in_path(mozbuild_path))
- self.assertEquals(set(paths), set([
- os.path.join(os.path.abspath(mozbuild_path), '__init__.py'),
- os.path.join(os.path.abspath(mozbuild_path), 'pythonutil.py'),
- os.path.join(os.path.abspath(mozbuild_path), 'test', '__init__.py'),
- os.path.join(os.path.abspath(mozbuild_path), 'test', 'test_pythonutil.py'),
- ]))
+def test_iter_modules_in_path():
+ tests_path = os.path.normcase(os.path.dirname(__file__))
+ paths = list(iter_modules_in_path(tests_path))
+ assert set(paths) == set([
+ os.path.join(os.path.abspath(tests_path), '__init__.py'),
+ os.path.join(os.path.abspath(tests_path), 'test_pythonutil.py'),
+ ])
if __name__ == '__main__':
main()