Skip to content

Commit

Permalink
devel/py-cookiecutter: switch to USE_PYTHON=pytest
Browse files Browse the repository at this point in the history
Use the standard pytest setup.  Disable one windows specific test

While here, allow py311 flavor.  Upstream has not specified 3.11 as
supported, but there hasn't been any significant development on this
module since before python-3.11 was released, and the code runs just
fine.  This means that a py311 flavour of molecule should now be
available.

No portrevision bump, as this just adds a new flavour; existing
flavours are unchanged.
  • Loading branch information
infracaninophile committed Jun 8, 2023
1 parent d60f76b commit 126112c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
13 changes: 6 additions & 7 deletions devel/py-cookiecutter/Makefile
Expand Up @@ -25,8 +25,8 @@ TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}freezegun>0:devel/py-freezegun@${PY_FLAVOR}
${PYTHON_PKGNAMEPREFIX}pytest>0:devel/py-pytest@${PY_FLAVOR} \
git:devel/git

USES= cpe python:3.7-3.10
USE_PYTHON= autoplist concurrent distutils
USES= cpe python:3.7+
USE_PYTHON= autoplist concurrent distutils pytest

CPE_VENDOR= cookiecutter_project

Expand All @@ -36,12 +36,11 @@ NO_ARCH= yes
# ${WRKDIR} unless told not to.

TEST_ENV= HOME=${WRKDIR} \
LANG=en_US.UTF-8 \
LC_ALL=en_US.UTF-8 \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
TMPDIR=${WRKDIR}

do-test:
@cd ${WRKSRC} && \
${SETENV} ${TEST_ENV} ${LOCALBASE}/bin/pytest-${PYTHON_VER} --cov=cookiecutter tests
# Windows specific test
PYTEST_IGNORED_TESTS= test_run_shell_hooks_win

.include <bsd.port.mk>
15 changes: 12 additions & 3 deletions devel/py-cookiecutter/files/patch-tests_test__hooks.py
@@ -1,6 +1,6 @@
--- tests/test_hooks.py.orig 2020-12-28 09:57:55 UTC
--- tests/test_hooks.py.orig 2022-06-01 17:00:44 UTC
+++ tests/test_hooks.py
@@ -42,7 +42,7 @@ def make_test_repo(name):
@@ -41,7 +41,7 @@ def make_test_repo(name, multiple_hooks=False):
post = 'post_gen_project.sh'
filename = os.path.join(hook_dir, post)
with open(filename, 'w') as f:
Expand All @@ -9,7 +9,16 @@
f.write("\n")
f.write("echo 'post generation hook';\n")
f.write("touch 'shell_post.txt'\n")
@@ -143,7 +143,7 @@ class TestExternalHooks(object):
@@ -61,7 +61,7 @@ def make_test_repo(name, multiple_hooks=False):
pre = 'pre_gen_project.sh'
filename = os.path.join(hook_dir, pre)
with open(filename, 'w') as f:
- f.write("#!/bin/bash\n")
+ f.write("#!/bin/sh\n")
f.write("\n")
f.write("echo 'post generation hook';\n")
f.write("touch 'shell_pre.txt'\n")
@@ -189,7 +189,7 @@ class TestExternalHooks:
f.write("echo. >{{cookiecutter.file}}\n")
else:
with open(hook_path, 'w') as fh:
Expand Down

0 comments on commit 126112c

Please sign in to comment.