Bug 1304593 - Fix broken test_entry_point.py in mach, r=gps
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Tue, 27 Sep 2016 17:11:00 -0400
changeset 316197 180d4a79ad6f0c041097b49561e20e41054d4f11
parent 316196 7735d1c35d290bff03210283511daeb288a4f830
child 316198 9d5982f805c9b8cc26360ebafb9519c7414434e9
push id30765
push userphilringnalda@gmail.com
push dateTue, 04 Oct 2016 03:06:46 +0000
treeherdermozilla-central@adb484f84dec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1304593 - Fix broken test_entry_point.py in mach, r=gps Fix and enable python/mach/mach/test/test_entry_poiny.py. MozReview-Commit-ID: FtMpt8Nmq3g
--- a/python/mach/mach/test/test_entry_point.py
+++ b/python/mach/mach/test/test_entry_point.py
@@ -11,50 +11,51 @@ from mach.base import MachError
 from mach.test.common import TestBase
 from mock import patch
 from mozunit import main
 here = os.path.abspath(os.path.dirname(__file__))
 class Entry():
     """Stub replacement for pkg_resources.EntryPoint"""
     def __init__(self, providers):
         self.providers = providers
     def load(self):
         def _providers():
             return self.providers
         return _providers
 class TestEntryPoints(TestBase):
     """Test integrating with setuptools entry points"""
     provider_dir = os.path.join(here, 'providers')
     def _run_mach(self):
         return TestBase._run_mach(self, ['help'], entry_point='mach.providers')
     def test_load_entry_point_from_directory(self, mock):
         # Ensure parent module is present otherwise we'll (likely) get
         # an error due to unknown parent.
         if b'mach.commands' not in sys.modules:
             mod = imp.new_module(b'mach.commands')
             sys.modules[b'mach.commands'] = mod
-        mock.return_value = [Entry(['providers'])]
+        mock.return_value = [Entry([self.provider_dir])]
         # Mach error raised due to conditions_invalid.py
         with self.assertRaises(MachError):
     def test_load_entry_point_from_file(self, mock):
-        mock.return_value = [Entry([os.path.join('providers', 'basic.py')])]
+        mock.return_value = [Entry([os.path.join(self.provider_dir, 'basic.py')])]
         result, stdout, stderr = self._run_mach()
         self.assertIn('cmd_foo', stdout)
-# Not enabled in automation because tests are failing.
-#if __name__ == '__main__':
-#    main()
+if __name__ == '__main__':
+    main()