simplified reset

This commit is contained in:
John Lancaster
2024-08-12 20:52:32 -05:00
parent 0c01f2c4d7
commit 0fcc8ac652

View File

@@ -11,15 +11,9 @@ from git import Repo
from .utils import get_load_order
def reset_file(changed: Path):
for p in Path(__file__).parents:
if p.with_name('.git').exists():
root = p.parent
break
repo = Repo(root)
def reset_file(repo: Repo, changed: Path):
if not changed.is_absolute():
changed = root / changed
changed = Path(repo.working_tree_dir) / changed
repo.git.checkout('HEAD', '--', changed)
@@ -43,5 +37,5 @@ def test_file(ad: AppDaemon, caplog: pytest.LogCaptureFixture, config_repo: Repo
module_load_order = get_load_order(caplog)
assert module_load_order == ['food.meal', 'restaurant']
reset_file(module_file)
reset_file(config_repo, module_file)
ad.loop.run_until_complete(asyncio.sleep(1.0))