fix: fix directory structure and test files
This commit is contained in:
6
tests/test.tampy
Normal file
6
tests/test.tampy
Normal file
@@ -0,0 +1,6 @@
|
||||
x = 1
|
||||
y = 2
|
||||
if x > y:
|
||||
print("x is greater")
|
||||
else:
|
||||
print("y is greater")
|
||||
@@ -9,19 +9,20 @@ from pathlib import Path
|
||||
def test_build_command():
|
||||
"""Test build command."""
|
||||
result = subprocess.run(
|
||||
[sys.executable, "-m", "tampy", "build", "test.tampy"],
|
||||
[sys.executable, "-m", "tampy", "build", "tests/test.tampy"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
env={**dict(os.environ), "PYTHONPATH": "src"}
|
||||
)
|
||||
assert result.returncode == 0
|
||||
assert "Generated:" in result.stdout
|
||||
assert Path("tests/test.py").exists()
|
||||
|
||||
|
||||
def test_run_command():
|
||||
"""Test run command."""
|
||||
result = subprocess.run(
|
||||
[sys.executable, "-m", "tampy", "run", "test.tampy"],
|
||||
[sys.executable, "-m", "tampy", "run", "tests/test.tampy"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
env={**dict(os.environ), "PYTHONPATH": "src"}
|
||||
@@ -33,10 +34,10 @@ def test_run_command():
|
||||
def test_file_extension_replacement():
|
||||
"""Test that .tampy is replaced with .py."""
|
||||
result = subprocess.run(
|
||||
[sys.executable, "-m", "tampy", "build", "test.tampy"],
|
||||
[sys.executable, "-m", "tampy", "build", "tests/test.tampy"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
env={**dict(os.environ), "PYTHONPATH": "src"}
|
||||
)
|
||||
assert result.returncode == 0
|
||||
assert Path("test.py").exists()
|
||||
assert Path("tests/test.py").exists()
|
||||
|
||||
Reference in New Issue
Block a user