Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
romnn committed Feb 14, 2021
1 parent 4114394 commit c965888
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 64 deletions.
59 changes: 7 additions & 52 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"project_name": "Python Package Template",
"project_slug": "{{ cookiecutter.project_name.lower().replace(' ', '_').replace('-', '_') }}",
"pypi_username": "{{ cookiecutter.github_username }}",
"version": "0.1.0"
"version": "0.1.0",
"_copy_without_render": [
".github/workflows/*"
]
}
23 changes: 13 additions & 10 deletions hooks/post_gen_project.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
import os
import time
import subprocess
import subprocess as sp


class _Halo:
Expand All @@ -25,9 +25,12 @@ def _print(text):
try:
from halo import Halo
except (ImportError, ModuleNotFoundError):
subprocess.check_output(
"pip install --no-cache-dir halo", stderr=subprocess.STDOUT, shell=True
)
try:
sp.check_output(
"pip install --no-cache-dir halo", stderr=sp.STDOUT, shell=True
)
except sp.CalledProcessError:
pass

try:
from halo import Halo
Expand All @@ -41,8 +44,8 @@ def _print(text):

def run_command(*cmd_args, **cmd_kwargs):
try:
return subprocess.check_output(*cmd_args, **cmd_kwargs).decode("utf-8")
except subprocess.CalledProcessError as e:
return sp.check_output(*cmd_args, **cmd_kwargs).decode("utf-8")
except sp.CalledProcessError as e:
print(e.returncode)
print(e.output.decode("utf-8"))
raise
Expand All @@ -52,10 +55,10 @@ def install_git_hooks():
with Halo(text="Installing git hooks", spinner="dots", color="cyan") as spinner:
try:
run_command(
"pipenv run pre-commit install -t pre-commit", stderr=subprocess.STDOUT, shell=True
"pipenv run pre-commit install -t pre-commit", stderr=sp.STDOUT, shell=True
)
run_command(
"pipenv run pre-commit install -t pre-push", stderr=subprocess.STDOUT, shell=True
"pipenv run pre-commit install -t pre-push", stderr=sp.STDOUT, shell=True
)
time.sleep(0.5)
except Exception:
Expand All @@ -69,7 +72,7 @@ def initialize_git():
try:
run_command(
"cd {} && git init".format(PROJECT_DIRECTORY),
stderr=subprocess.STDOUT,
stderr=sp.STDOUT,
shell=True,
)
time.sleep(0.5)
Expand All @@ -82,7 +85,7 @@ def initialize_git():
def install_dependencies():
with Halo(text="Installing development dependencies", spinner="dots", color="magenta") as spinner:
try:
run_command("pipenv install --clear --dev", stderr=subprocess.STDOUT, shell=True)
run_command("pipenv install --clear --dev", stderr=sp.STDOUT, shell=True)
except Exception:
spinner.fail("Failed to install development dependencies")
raise
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_slug}}/CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Before you submit a pull request, check that it meets these guidelines:

1. The pull request should include tests.
2. The pull request should work for python 3.5+. Check the
`build status of your pull request <https://travis-ci.{{ cookiecutter.travis_plan }}/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}/pull_requests>`_
`build status of your pull request <https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}/actions>`_
and make sure that all tests pass for all supported python versions.

Publishing (Maintainers only)
Expand Down

0 comments on commit c965888

Please sign in to comment.