예제 #1
0
    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')
예제 #2
0
    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')))
예제 #3
0
    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)
예제 #4
0
    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))
예제 #5
0
    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))