-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update ruff commands and pyproject dependencies
- Loading branch information
Showing
11 changed files
with
145 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
""" | ||
Unit test file. | ||
""" | ||
|
||
import os | ||
import unittest | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import sys | ||
|
||
try: | ||
from isolated_environment import api | ||
|
||
print(api) | ||
print("Successfully imported IsolatedEnvironment") | ||
# print the path to find the isolated_environment module | ||
# print(api.__file__) | ||
print(f"IsolatedEnvironment path: {api.__file__}") | ||
# print out the python path | ||
# print(sys.path) | ||
# print out the python executable | ||
print(f"Python executable: {sys.executable}") | ||
sys.exit(0) | ||
except ImportError: | ||
print("Failed to import IsolatedEnvironment") | ||
sys.exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
""" | ||
Unit test file. | ||
""" | ||
|
||
import json | ||
import os | ||
import shutil | ||
import subprocess | ||
import unittest | ||
from pathlib import Path | ||
from tempfile import TemporaryDirectory | ||
from typing import Any | ||
|
||
from isolated_environment.api import IsolatedEnvironment | ||
|
||
HERE = Path(__file__).parent.absolute() | ||
TEST_DATA = HERE / "test_data" | ||
INNER_PY = TEST_DATA / "inner.py" | ||
|
||
assert INNER_PY.exists(), f"Missing: {INNER_PY}" | ||
|
||
|
||
def pretty(data: Any) -> str: | ||
"""Make JSON beautiful.""" | ||
return json.dumps(data, indent=4, sort_keys=True) | ||
|
||
|
||
class FullIoslationTester(unittest.TestCase): | ||
"""Main tester class.""" | ||
|
||
def test_ensure_installed(self) -> None: | ||
"""Tests that ensure_installed works.""" | ||
with TemporaryDirectory() as tmp_dir: | ||
prev_dir = os.getcwd() | ||
os.chdir(tmp_dir) | ||
shutil.copy(INNER_PY, tmp_dir) | ||
try: | ||
iso_env = IsolatedEnvironment( | ||
Path(tmp_dir) / "venv", requirements=None, full_isolation=True | ||
) | ||
# now create an inner environment without the static-ffmpeg | ||
cp: subprocess.CompletedProcess = iso_env.run(["python", "inner.py"]) | ||
self.assertEqual(1, cp.returncode) | ||
finally: | ||
os.chdir(prev_dir) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
""" | ||
Unit test file. | ||
""" | ||
|
||
import unittest | ||
|
||
from isolated_environment.requirements import Requirements | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters