Add itest for pseudobuilder
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
IamTheFij 2024-11-06 16:13:58 -08:00
parent 564a120bfe
commit bb0b82ab72
2 changed files with 47 additions and 1 deletions

46
pseudo_builder_test.py Normal file
View File

@ -0,0 +1,46 @@
from __future__ import annotations
import shutil
import subprocess
import venv
from pathlib import Path
from unittest import TestCase
ITEST_VENV_PATH = Path("venv-itest")
class TestPseudoBuilder(TestCase):
def setUp(self):
venv.create(
ITEST_VENV_PATH,
system_site_packages=False,
clear=True,
with_pip=True,
)
self.pip_install("-e", ".[builder]")
def tearDown(self):
shutil.rmtree(ITEST_VENV_PATH)
def pip_install(self, *args: str):
subprocess.run(
[str(ITEST_VENV_PATH.joinpath("bin", "pip")), "install", *args],
check=True,
)
def test_install_remote_package(self):
self.assertTrue(ITEST_VENV_PATH.exists())
self.assertTrue(ITEST_VENV_PATH.joinpath("bin", "python").exists())
self.assertTrue(ITEST_VENV_PATH.joinpath("bin", "pip").exists())
itest_packages = {
"stylua": "git+https://github.com/JohnnyMorganz/StyLua",
"selene": "git+https://github.com/amitds1997/selene",
}
for package, source in itest_packages.items():
self.pip_install("--no-index", "--no-build-isolation", source)
# Check if the package is installed
assert ITEST_VENV_PATH.joinpath("bin", package).exists()
# Check if the package has executable permissions
assert ITEST_VENV_PATH.joinpath("bin", package).stat().st_mode & 0o111

View File

@ -48,7 +48,7 @@ dependencies = [
[tool.hatch.envs.test.scripts]
run = [
"coverage erase",
"coverage run --source=release_gitter -m unittest discover . *_test.py",
"coverage run --source=release_gitter -m unittest discover -p '*_test.py'",
"coverage report -m # --fail-under 70",
]