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')
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())
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))
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))
def test_set_plugindir(self): plugindir = os.path.join(self.path, 'testplugin') common.set_plugindir(plugindir) self.assertEqual(plugindir, common.get_plugindir())
def test_get_default_plugindir(self): self.assertEqual( '/usr/share/snapcraft/plugins', common.get_plugindir())
def test_get_default_plugindir(self): self.assertEqual('/usr/share/snapcraft/plugins', common.get_plugindir())