From fae591ac2b2fde84fd225c7e74b7fc24f54ddaaa Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Tue, 27 Sep 2016 17:11:00 -0400 Subject: [PATCH] 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 --HG-- extra : rebase_source : 73755266b7d9570065c0ab18e0b50e074559914c --- python/mach/mach/test/test_entry_point.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/python/mach/mach/test/test_entry_point.py b/python/mach/mach/test/test_entry_point.py index 5bd2c279d45c..7aea91e5e46c 100644 --- a/python/mach/mach/test/test_entry_point.py +++ b/python/mach/mach/test/test_entry_point.py @@ -16,6 +16,7 @@ from mozunit import main here = os.path.abspath(os.path.dirname(__file__)) + class Entry(): """Stub replacement for pkg_resources.EntryPoint""" def __init__(self, providers): @@ -26,6 +27,7 @@ class Entry(): return self.providers return _providers + class TestEntryPoints(TestBase): """Test integrating with setuptools entry points""" provider_dir = os.path.join(here, 'providers') @@ -41,20 +43,19 @@ class TestEntryPoints(TestBase): 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): self._run_mach() @patch('pkg_resources.iter_entry_points') 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.assertIsNone(result) self.assertIn('cmd_foo', stdout) -# Not enabled in automation because tests are failing. -#if __name__ == '__main__': -# main() +if __name__ == '__main__': + main()