def test_split_path_absent_undefined_behaviour(self, request): logger.info(f'{request._pyfuncitem.name}()') pck = '.'.join(['tests_data', __package__, 'ymlparsers']) with path(pck, 'config.yml') as f: with pytest.raises(BaseException): split_path(f, 'xxxnotfoundxxx')
def test_split_path_absent_compount_name(self, request): logger.info(f'{request._pyfuncitem.name}()') pck = '.'.join(['tests_data', __package__, 'ymlparsers']) with path(pck, 'config.yml') as f: with pytest.raises(BaseException): split_path(f, str(Path('ymlparsers', 'config.yml')))
def test_split_path_empty_str(self, request): logger.info(f'{request._pyfuncitem.name}()') split_dirname = 'ymlparsers' pck = '.'.join(['tests_data', __package__, split_dirname]) with path(pck, 'config.yml') as f: with pytest.raises(BaseException): split_path(f, None)
def test_split_path_intented_path(self, request): logger.info(f'{request._pyfuncitem.name}()') split_dirname = 'ymlparsers' pck = '.'.join(['tests_data', __package__, split_dirname]) with path(pck, 'config.yml') as f: first_part, second_part = split_path(Path(f), Path(split_dirname)) pytest.assume(f.parent == first_part) pytest.assume('config.yml' == str(second_part))
def test_split_path_twice_split_dir(self, request): logger.info(f'{request._pyfuncitem.name}()') split_dirname = 'tests' pck = '.'.join(['tests_data', __package__, 'ymlparsers']) with path(pck, 'config.yml') as f: assert split_dirname in f.parts duplicate_dir_base = f.parent / split_dirname duplicate_dir_full_path = duplicate_dir_base / f.name first_part, second_part = split_path(duplicate_dir_full_path, split_dirname) pytest.assume(duplicate_dir_base == first_part) pytest.assume('config.yml' == str(second_part))