def test_no_fixtures_specified(self): # 'fixture_paths' is an optional key yaml_data = copy.deepcopy(self.YAML_DATA) del yaml_data['fixture_paths'] # Create an in-memory YAML file from the data yaml_file = self._yaml_buffer(yaml_data) # Create the suite description using the YAML file desc = SuiteDescription(yaml_file, self.temp_dir) # Check that we get an empty list of lib paths self.assertEqual(desc.fixture_paths(), [])
def test_different_working_dir(self): # Change the working directory temporarily # (the superclass will reset it afterwards) os.chdir(self.TEMP_DIRS[0]) # Create an in-memory YAML file from the data yaml_file = self._yaml_buffer(self.YAML_DATA) # Create the suite description using the YAML file desc = SuiteDescription(yaml_file, self.temp_dir) # Check that we find the files we expect self.assertEqual(desc.lib_paths(), self.LIB_FILES) self.assertEqual(desc.src_paths(), self.SRC_FILES) self.assertEqual(desc.spec_paths(), self.SPEC_FILES) self.assertEqual(desc.fixture_paths(), self.FIXTURE_FILES) self.assertEqual(desc.test_runner(), self.YAML_DATA['test_runner'])
def test_valid_description(self): # Create an in-memory YAML file from the data yaml_file = self._yaml_buffer(self.YAML_DATA) # Create the suite description using the YAML file desc = SuiteDescription(yaml_file, self.temp_dir) # Check that the root directory is stored self.assertEqual(desc.root_dir(), self.temp_dir) # Check that we find the files we expect self.assertEqual(desc.suite_name(), self.YAML_DATA['test_suite_name']) self.assertEqual(desc.lib_paths(), self.LIB_FILES) self.assertEqual(desc.src_paths(), self.SRC_FILES) self.assertEqual(desc.spec_paths(), self.SPEC_FILES) self.assertEqual(desc.fixture_paths(), self.FIXTURE_FILES) self.assertEqual(desc.test_runner(), self.YAML_DATA['test_runner']) self.assertEqual(desc.prepend_path(), '')
def test_repeated_paths(self): # Repeat paths that are already included in the directories yaml_data = copy.deepcopy(self.YAML_DATA) yaml_data['src_paths'].append(self.SRC_FILES[0]) yaml_data['spec_paths'].append(self.SPEC_FILES[0]) yaml_data['lib_paths'].append(self.LIB_FILES[0]) yaml_data['fixture_paths'].append(self.FIXTURE_FILES[0]) # Create an in-memory YAML file from the data yaml_file = self._yaml_buffer(yaml_data) # Create the suite description using the YAML file desc = SuiteDescription(yaml_file, self.temp_dir) # Check that we ignore repeats self.assertEqual(desc.lib_paths(), self.LIB_FILES) self.assertEqual(desc.src_paths(), self.SRC_FILES) self.assertEqual(desc.spec_paths(), self.SPEC_FILES) self.assertEqual(desc.fixture_paths(), self.FIXTURE_FILES)