eviweb / cookiecutter-template

a cookiecutter template to help in creating... cookiecutter templates
MIT License
71 stars 32 forks source link

Fix a test error in a fresh project. #9

Closed yanqd0 closed 6 years ago

yanqd0 commented 6 years ago

Error

When a new project is generated, the pytest will always fail!

cookies = <pytest_cookies.Cookies object at 0x7f723681c710>
    def test_run_flake8(cookies):
        result = cookies.bake(extra_context={'project_slug': 'flake8_compat'})
        with inside_dir(str(result.project)):
>           assert os.subprocess.check_call(['flake8']) == 0
E           AttributeError: module 'os' has no attribute 'subprocess'
tests/test_bake_project.py:30: AttributeError

An online error example: https://travis-ci.org/yanqd0/cookiecutter-serious-pycli/builds/447092846

Solution

The subprocess has become an independent module for a long time.

By the way, the check_call will always return 0, if it is not crashed. So I delete the unnecessary assert.

Test

I really don't know how to test this with Mamba, so the regression test is missing.

eviweb commented 6 years ago

Hi @yanqd0, many thanks