コード例 #1
0
ファイル: __init__.py プロジェクト: morphis/snapcraft
    def setUp(self):
        super().setUp()
        temp_cwd_fixture = fixture_setup.TempCWD()
        self.useFixture(temp_cwd_fixture)
        self.path = temp_cwd_fixture.path
        # Some tests will directly or indirectly change the plugindir, which
        # is a module variable. Make sure that it is returned to the original
        # value when a test ends.
        self.addCleanup(common.set_plugindir, common.get_plugindir())
        self.addCleanup(common.set_schemadir, common.get_schemadir())
        self.addCleanup(common.set_schemadir, common.get_schemadir())
        self.addCleanup(common.reset_env)
        common.set_schemadir(os.path.join(__file__,
                             '..', '..', '..', 'schema'))
        self.useFixture(fixtures.FakeLogger(level=logging.ERROR))

        patcher = mock.patch('multiprocessing.cpu_count')
        self.cpu_count = patcher.start()
        self.cpu_count.return_value = 2
        self.addCleanup(patcher.stop)

        # These are what we expect by default
        self.snap_dir = os.path.join(os.getcwd(), 'snap')
        self.stage_dir = os.path.join(os.getcwd(), 'stage')
        self.parts_dir = os.path.join(os.getcwd(), 'parts')
        self.local_plugins_dir = os.path.join(self.parts_dir, 'plugins')
コード例 #2
0
ファイル: __init__.py プロジェクト: kightlygeorge/snapcraft
 def setUp(self):
     super().setUp()
     temp_cwd_fixture = fixture_setup.TempCWD()
     self.useFixture(temp_cwd_fixture)
     self.path = temp_cwd_fixture.path
     # Some tests will directly or indirectly change the plugindir, which
     # is a module variable. Make sure that it is returned to the original
     # value when a test ends.
     self.addCleanup(common.set_plugindir, common.get_plugindir())
     self.addCleanup(common.set_schemadir, common.get_schemadir())
コード例 #3
0
 def setUp(self):
     super().setUp()
     temp_cwd_fixture = fixture_setup.TempCWD()
     self.useFixture(temp_cwd_fixture)
     self.path = temp_cwd_fixture.path
     # Some tests will directly or indirectly change the plugindir, which
     # is a module variable. Make sure that it is returned to the original
     # value when a test ends.
     self.addCleanup(common.set_plugindir, common.get_plugindir())
     self.addCleanup(common.set_schemadir, common.get_schemadir())
コード例 #4
0
ファイル: __init__.py プロジェクト: LefterisJP/snapcraft
 def setUp(self):
     super().setUp()
     temp_cwd_fixture = fixture_setup.TempCWD()
     self.useFixture(temp_cwd_fixture)
     self.path = temp_cwd_fixture.path
     # Some tests will directly or indirectly change the plugindir, which
     # is a module variable. Make sure that it is returned to the original
     # value when a test ends.
     self.addCleanup(common.set_plugindir, common.get_plugindir())
     self.addCleanup(common.set_schemadir, common.get_schemadir())
     self.addCleanup(common.set_schemadir, common.get_schemadir())
     self.addCleanup(common.reset_env)
     common.set_schemadir(os.path.join(__file__,
                          '..', '..', '..', 'schema'))
     self.useFixture(fixtures.FakeLogger(level=logging.ERROR))
コード例 #5
0
ファイル: __init__.py プロジェクト: techraf/snapcraft
 def setUp(self):
     super().setUp()
     temp_cwd_fixture = fixture_setup.TempCWD()
     self.useFixture(temp_cwd_fixture)
     self.path = temp_cwd_fixture.path
     # Some tests will directly or indirectly change the plugindir, which
     # is a module variable. Make sure that it is returned to the original
     # value when a test ends.
     self.addCleanup(common.set_plugindir, common.get_plugindir())
     self.addCleanup(common.set_schemadir, common.get_schemadir())
     self.addCleanup(common.set_schemadir, common.get_schemadir())
     self.addCleanup(common.set_enable_parallel_builds,
                     common.get_enable_parallel_builds())
     self.addCleanup(common.reset_env)
     common.set_schemadir(os.path.join(__file__, '..', '..', '..',
                                       'schema'))
     self.useFixture(fixtures.FakeLogger(level=logging.ERROR))
コード例 #6
0
ファイル: test_common.py プロジェクト: lool/snapcraft
 def test_set_plugindir(self):
     plugindir = os.path.join(self.path, 'testplugin')
     common.set_plugindir(plugindir)
     self.assertEqual(plugindir, common.get_plugindir())
コード例 #7
0
ファイル: test_common.py プロジェクト: lool/snapcraft
 def test_get_default_plugindir(self):
     self.assertEqual(
         '/usr/share/snapcraft/plugins', common.get_plugindir())
コード例 #8
0
 def test_set_plugindir(self):
     plugindir = os.path.join(self.path, 'testplugin')
     common.set_plugindir(plugindir)
     self.assertEqual(plugindir, common.get_plugindir())
コード例 #9
0
 def test_get_default_plugindir(self):
     self.assertEqual('/usr/share/snapcraft/plugins',
                      common.get_plugindir())