simplified reset
This commit is contained in:
@@ -11,15 +11,9 @@ from git import Repo
|
|||||||
from .utils import get_load_order
|
from .utils import get_load_order
|
||||||
|
|
||||||
|
|
||||||
def reset_file(changed: Path):
|
def reset_file(repo: Repo, changed: Path):
|
||||||
for p in Path(__file__).parents:
|
|
||||||
if p.with_name('.git').exists():
|
|
||||||
root = p.parent
|
|
||||||
break
|
|
||||||
|
|
||||||
repo = Repo(root)
|
|
||||||
if not changed.is_absolute():
|
if not changed.is_absolute():
|
||||||
changed = root / changed
|
changed = Path(repo.working_tree_dir) / changed
|
||||||
repo.git.checkout('HEAD', '--', 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)
|
module_load_order = get_load_order(caplog)
|
||||||
assert module_load_order == ['food.meal', 'restaurant']
|
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))
|
ad.loop.run_until_complete(asyncio.sleep(1.0))
|
||||||
|
|||||||
Reference in New Issue
Block a user