Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    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
Exemplo n.º 3
0
    def test_find_config_nonfound(self):
        config = Config.find(Path(Path(__file__).root))

        self.assertIsNone(config.path)
Exemplo n.º 4
0
 def test_find_config_nonfound(self) -> None:
     assert not Config.find(Path(Path(__file__).root))
Exemplo n.º 5
0
 def test_find_config_current_dir_invalid(self) -> None:
     assert not Config.find(StdPath("tests/test_main.py"))
Exemplo n.º 6
0
    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
Exemplo n.º 7
0
 def test_find_invalid(self) -> None:
     path = Path(__file__).parent / "test_data" / "invalid"
     assert not Config.find(path, root=path.parent)