def setup_method(self, test_method): self.single_file_config = repex._get_config(MOCK_SINGLE_FILE) self.single_file_output_file = \ self.single_file_config['paths'][0]['to_file'] self.multi_file_config = repex._get_config(MOCK_MULTIPLE_FILES) self.multi_file_excluded_dirs = \ self.multi_file_config['paths'][0]['excluded']
def setUp(self): super(TestValidator, self).setUp() self.single_file_config = repex._get_config(MOCK_SINGLE_FILE) self.validation_config = repex._get_config(MOCK_FILES_WITH_VALIDATOR) self.single_file_output_file = \ self.single_file_config['paths'][0]['to_file'] self.validator_config = self.validation_config['paths'][0]['validator']
def setUp(self): super(TestSingleFile, self).setUp() self.single_file_config = repex._get_config(MOCK_SINGLE_FILE) self.single_file_output_file = \ self.single_file_config['paths'][0]['to_file'] self.multi_file_config = repex._get_config(MOCK_MULTIPLE_FILES) self.multi_file_excluded_dirs = \ self.multi_file_config['paths'][0]['excluded']
def setup_method(self, test_method): self.single_file_config = repex._get_config(MOCK_SINGLE_FILE) self.with_validator_config = repex._get_config( MOCK_FILES_WITH_VALIDATOR) self.single_file_output_file = \ self.single_file_config['paths'][0]['to_file'] self.validator_config = \ self.with_validator_config['paths'][0]['validator']
def setup_method(self, test_method): self.multi_file_config = repex._get_config(MOCK_MULTIPLE_FILES) self.multi_file_excluded_dirs = \ self.multi_file_config['paths'][0]['excluded'] self.excluded_files = \ [os.path.join(self.multi_file_excluded_dirs[0], TEST_FILE_NAME)] self.base_dir = self.multi_file_config['paths'][0]['base_directory'] for root, _, files in os.walk(MULTIPLE_DIR): self.version_files = \ [os.path.join(root, f) for f in files if f == 'mock_VERSION'] self.version_files_without_excluded = \ [f for f in self.version_files if f != EXCLUDED_FILE] self.excluded_files = [f for f in self.version_files if f not in self.version_files_without_excluded]
def test_import_config_file(self): config = repex._get_config(config_file_path=MOCK_SINGLE_FILE) self.assertEquals(type(config['paths']), list) self.assertEquals(type(config['variables']), dict)
def setup_method(self, test_method): self.config = repex._get_config( os.path.join(TEST_RESOURCES_DIR, 'match_replace_config.yaml')) self.output_file = self.config['paths'][0]['to_file']
def test_import_bad_config_file_mapping(self): with pytest.raises(repex.RepexError) as ex: repex._get_config(config_file_path=os.path.join( TEST_RESOURCES_DIR, 'bad_mock_files.yaml')) assert repex.ERRORS['invalid_yaml'] in str(ex)
def test_config_file_not_found(self): with pytest.raises(repex.RepexError) as ex: repex._get_config(config_file_path='non_existing_path') assert repex.ERRORS['config_file_not_found'] in str(ex)
def test_import_config_file(self): config = repex._get_config(config_file_path=MOCK_SINGLE_FILE) assert type(config['paths']) == list assert type(config['variables']) == dict