mirror of
https://github.com/nix-community/nix-direnv.git
synced 2025-11-08 19:46:11 +01:00
Fix tests for empty nixfile
This commit is contained in:
parent
7af01eeb72
commit
77efe5abca
2 changed files with 16 additions and 6 deletions
|
|
@ -1,10 +1,11 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
from dataclasses import dataclass
|
||||
import shutil
|
||||
import textwrap
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
from typing import Iterator
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
|
|
@ -21,12 +22,13 @@ class DirenvProject:
|
|||
return self.dir / ".envrc"
|
||||
|
||||
def setup_envrc(self, content: str) -> None:
|
||||
self.envrc.write_text(
|
||||
text = textwrap.dedent(
|
||||
f"""
|
||||
source {self.nix_direnv}
|
||||
{content}
|
||||
source {self.nix_direnv}
|
||||
{content}
|
||||
"""
|
||||
)
|
||||
self.envrc.write_text(text)
|
||||
run(["direnv", "allow"], cwd=self.dir)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,15 @@ def test_args(direnv_project: DirenvProject) -> None:
|
|||
|
||||
def test_no_files(direnv_project: DirenvProject) -> None:
|
||||
direnv_project.setup_envrc("use nix -p hello")
|
||||
direnv_exec(direnv_project, "hello")
|
||||
out = run(
|
||||
["direnv", "status"],
|
||||
stderr=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
check=False,
|
||||
cwd=direnv_project.dir,
|
||||
)
|
||||
assert out.returncode == 0
|
||||
assert 'Loaded watch: "."' not in out.stdout
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue