Skip to content

Commit bb24189

Browse files
Merge pull request #33 from kognitos/improve-host
fix: improve run host to use cached dependencies
2 parents c66b015 + 35bf81c commit bb24189

8 files changed

Lines changed: 494 additions & 55 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,5 @@ cython_debug/
170170
# Terraform
171171
**/.terraform.lock.hcl
172172
**/.terraform
173+
174+
.envrc

poetry.lock

Lines changed: 33 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description = "A cookiecutter template for developing Kognitos Books"
55
authors = ["Emiliano Lesende <emiliano@kognitos.com>"]
66
readme = "README.md"
77
package-mode = false
8-
packages = [{include = "*.py", from="."}]
8+
packages = [{ include = "*.py", from = "." }]
99

1010
[tool.poetry.dependencies]
1111
python = ">=3.11,<4.0"
@@ -18,8 +18,8 @@ isort = "^5.13.2"
1818
black = "^24.2.0"
1919
pre-commit = "^3.6.2"
2020
twine = "^5.0.0"
21-
kognitos-bdk-api = "^1.12"
22-
kognitos-bdk-linter = "^1.12"
21+
kognitos-bdk-api = "^1.23"
22+
kognitos-bdk-linter = "^1.25"
2323
kognitos-bdk-klang = "^2.2"
2424

2525
[tool.poetry.scripts]

tests/generate_project.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,6 @@ def generate_project(request, tmpdir):
3131
extra_context=request.param,
3232
output_dir=output_dir,
3333
)
34-
return os.path.join(output_dir, "book-" + request.param["project_slug"].replace("_", "-"))
34+
return os.path.join(
35+
output_dir, "book-" + request.param["project_slug"].replace("_", "-")
36+
)

tests/test_run_tests.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
21
import subprocess
3-
import pytest
42

3+
import pytest
54
from change_dir import change_dir
65
from generate_project import generate_project
76

8-
97
PROJECT_SLUG = "test_project"
108
PROJECT_NAME = "Test Project"
119

1210

1311
def run_tests(project_directory):
1412
with change_dir(project_directory):
15-
install_result = subprocess.run(["poetry", "install"], capture_output=True, text=True)
16-
tests_result = subprocess.run(["poetry", "run", "tests"], capture_output=True, text=True)
13+
install_result = subprocess.run(
14+
["poetry", "install"], capture_output=True, text=True
15+
)
16+
tests_result = subprocess.run(
17+
["poetry", "run", "tests"], capture_output=True, text=True
18+
)
1719

1820
return install_result, tests_result
1921

@@ -26,6 +28,9 @@ def run_tests(project_directory):
2628
def test_run_tests_passes(generate_project):
2729
install_result, tests_result = run_tests(generate_project)
2830

29-
assert install_result.returncode == 0, "'poetry install' command failed in generated book"
30-
assert tests_result.returncode == 0, f"'poetry run tests' command failed in generated book. Output: \n\n{tests_result.stdout}"
31-
31+
assert (
32+
install_result.returncode == 0
33+
), "'poetry install' command failed in generated book"
34+
assert (
35+
tests_result.returncode == 0
36+
), f"'poetry run tests' command failed in generated book. Output: \n\n{tests_result.stdout}"

0 commit comments

Comments
 (0)