def test_find_config(self): config = Config.find(Path(__file__)) expected_config = Path(__file__).parent.parent.joinpath( IMPORTANIZE_SETUP_CONFIG ) self.assertEqual(config.path, expected_config)
def test_find_config_current_dir(self) -> None: # If path is a file, and we have a config for the project and no # subconfig, and we dont find the config for the file, return the # passed config. config = Config.find(Path("tests/test_main.py")) # Instead of thekabsolute path, assume, user is running importanize # from the current directory. expected_config = Path( __file__).parent.parent / IMPORTANIZE_SETUP_CONFIG assert config.path == expected_config
def test_find_config_nonfound(self): config = Config.find(Path(Path(__file__).root)) self.assertIsNone(config.path)
def test_find_config_nonfound(self) -> None: assert not Config.find(Path(Path(__file__).root))
def test_find_config_current_dir_invalid(self) -> None: assert not Config.find(StdPath("tests/test_main.py"))
def test_find_config(self) -> None: config = Config.find(Path(__file__)) expected_config = Path( __file__).parent.parent / IMPORTANIZE_SETUP_CONFIG assert config.path == expected_config
def test_find_invalid(self) -> None: path = Path(__file__).parent / "test_data" / "invalid" assert not Config.find(path, root=path.parent)