Implement venv requirement
This commit is contained in:
parent
ed704f8957
commit
28db07d765
|
@ -1 +1,4 @@
|
|||
Pipfile.lock
|
||||
__pycache__/
|
||||
.venv*
|
||||
*.py[o|c]
|
||||
|
|
6
Makefile
6
Makefile
|
@ -4,3 +4,9 @@ tdd:
|
|||
|
||||
test:
|
||||
pipenv run pytest $(opt)
|
||||
|
||||
requirements:
|
||||
pipenv requirements > requirements.txt
|
||||
pipenv requirements --dev-only > requirements_dev.txt
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
PY_MINOR=11
|
||||
VENV_NAME=.venv_$(PY_MINOR)
|
||||
VENV=$(CURDIR)/$(VENV_NAME)
|
||||
python=$(VENV)/bin/python
|
||||
pip=$(python) -m pip
|
||||
|
||||
|
||||
_delete_venv:
|
||||
( [ -d $(VENV_NAME) ] && rm -fr $(VENV_NAME) ) || echo "no venv to drop"
|
||||
|
||||
|
||||
_create_venv:
|
||||
python3.$(PY_MINOR) -m venv $(VENV_NAME)
|
||||
|
||||
clean: _delete_venv _create_venv
|
||||
|
||||
|
||||
install:
|
||||
$(python) -m pip install -r requirements.txt
|
||||
|
||||
test:
|
||||
$(python) -m unittest --discover .
|
||||
|
||||
|
||||
run:
|
||||
$(python) dev.py
|
||||
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
-i https://pypi.org/simple
|
|
@ -0,0 +1,5 @@
|
|||
-i https://pypi.org/simple
|
||||
iniconfig==2.0.0 ; python_version >= '3.7'
|
||||
packaging==23.1 ; python_version >= '3.7'
|
||||
pluggy==1.2.0 ; python_version >= '3.7'
|
||||
pytest==7.4.0
|
|
@ -0,0 +1,38 @@
|
|||
"""
|
||||
Testing guidelines and install
|
||||
"""
|
||||
|
||||
import unittest
|
||||
from subprocess import run
|
||||
import pathlib
|
||||
|
||||
|
||||
class TestGuidelines(unittest.TestCase):
|
||||
def test_git(self):
|
||||
"The poj"
|
||||
|
||||
assert run(["git", "status"], check=True)
|
||||
|
||||
def test_has_requirement(self):
|
||||
root_dir = run(
|
||||
["git", "rev-parse", "--show-toplevel"], capture_output=True, text=True
|
||||
).stdout.strip()
|
||||
target = pathlib.Path(root_dir) / "requirements.txt"
|
||||
assert target.exists()
|
||||
|
||||
assert target.isFile()
|
||||
|
||||
def test_environment(self):
|
||||
"""We want to make sure that the project is virtualenv compatible.
|
||||
we may provie and extra makefile for that (and automate build phase)
|
||||
"""
|
||||
|
||||
venv = "-f", "MakefileVenv"
|
||||
|
||||
for step in ["clean", "install", "test"]:
|
||||
with self.subTest(setp=step):
|
||||
try:
|
||||
run(["make", *venv, step], check=True)
|
||||
except Exception as E:
|
||||
print(E.output)
|
||||
raise
|
Loading…
Reference in New Issue