def test_locate(self, dummy_project_dir):
        ipython_dir = dummy_project_dir / ".ipython" / "profile_default" / "startup"
        assert locate_ipython_startup_dir(dummy_project_dir) == ipython_dir

        path = dummy_project_dir / "notebooks" / "foo" / "bar"
        path.mkdir(parents=True)
        assert locate_ipython_startup_dir(path) == ipython_dir
    def test_locate_nested(self, nested_project_dir, dummy_project_dir):
        root_ipython_dir = (dummy_project_dir / ".ipython" /
                            "profile_default" / "startup")
        nested_ipython_dir = (nested_project_dir / ".ipython" /
                              "profile_default" / "startup")
        assert locate_ipython_startup_dir(
            nested_project_dir) == nested_ipython_dir
        assert locate_ipython_startup_dir(
            nested_project_dir.parent) == root_ipython_dir

        path = nested_project_dir / "notebooks" / "foo" / "bar"
        path.mkdir(parents=True)
        assert locate_ipython_startup_dir(path) == nested_ipython_dir

        path = dummy_project_dir / "other" / "dir"
        path.mkdir(parents=True)
        assert locate_ipython_startup_dir(path) == root_ipython_dir
 def test_locate_no_project(self, tmp_path):
     assert locate_ipython_startup_dir(str(tmp_path)) is None
     assert locate_ipython_startup_dir(Path("/")) is None