Skip to content

Commit

Permalink
Merge branch 'fix-tests-based-on-pypackage'
Browse files Browse the repository at this point in the history
  • Loading branch information
hackebrot committed Oct 17, 2015
2 parents 066aa64 + a617438 commit ef981da
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
19 changes: 9 additions & 10 deletions tests/test_cookiecutter_repo_arg.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def remove_additional_folders(request):
def fin_remove_additional_folders():
if os.path.isdir('cookiecutter-pypackage'):
utils.rmtree('cookiecutter-pypackage')
if os.path.isdir('boilerplate'):
utils.rmtree('boilerplate')
if os.path.isdir('python_boilerplate'):
utils.rmtree('python_boilerplate')
if os.path.isdir('cookiecutter-trytonmodule'):
utils.rmtree('cookiecutter-trytonmodule')
if os.path.isdir('module_name'):
Expand All @@ -37,20 +37,19 @@ def fin_remove_additional_folders():

@skipif_no_network
@pytest.mark.usefixtures('clean_system', 'remove_additional_folders')
def test_cookiecutter_git(monkeypatch):
monkeypatch.setattr(
'cookiecutter.prompt.read_user_variable',
lambda var, default: default
def test_cookiecutter_git():
main.cookiecutter(
'https://github.com/audreyr/cookiecutter-pypackage.git',
no_input=True
)
main.cookiecutter('https://github.com/audreyr/cookiecutter-pypackage.git')
clone_dir = os.path.join(
os.path.expanduser('~/.cookiecutters'),
'cookiecutter-pypackage'
)
assert os.path.exists(clone_dir)
assert os.path.isdir('boilerplate')
assert os.path.isfile('boilerplate/README.rst')
assert os.path.exists('boilerplate/setup.py')
assert os.path.isdir('python_boilerplate')
assert os.path.isfile('python_boilerplate/README.rst')
assert os.path.exists('python_boilerplate/setup.py')


@skipif_no_network
Expand Down
12 changes: 5 additions & 7 deletions tests/test_cookiecutters.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ def remove_additional_dirs(request):
Remove special directories which are creating during the tests.
"""
def fin_remove_additional_dirs():
if os.path.isdir('cookiecutter-pypackage'):
utils.rmtree('cookiecutter-pypackage')
if os.path.isdir('cookiecutter-jquery'):
utils.rmtree('cookiecutter-jquery')
if os.path.isdir('boilerplate'):
utils.rmtree('boilerplate')
for path in ('cookiecutter-pypackage', 'cookiecutter-jquery',
'python_boilerplate', 'boilerplate'):
if os.path.isdir(path):
utils.rmtree(path)
request.addfinalizer(fin_remove_additional_dirs)


Expand All @@ -39,7 +37,7 @@ def bake_data():
'git clone https://github.com/audreyr/cookiecutter-pypackage.git',
'cookiecutter --no-input cookiecutter-pypackage/',
'cookiecutter-pypackage',
'boilerplate/README.rst'
'python_boilerplate/README.rst'
)

jquery_data = (
Expand Down
4 changes: 3 additions & 1 deletion tests/test_more_cookiecutters.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def fin_remove_additional_dirs():
utils.rmtree('cookiecutter-pypackage')
if os.path.isdir('boilerplate'):
utils.rmtree('boilerplate')
if os.path.isdir('python_boilerplate'):
utils.rmtree('python_boilerplate')
request.addfinalizer(fin_remove_additional_dirs)


Expand Down Expand Up @@ -64,4 +66,4 @@ def test_cookiecutter_pypackage_git():
# Just skip all the prompts
proc.communicate(input=b'\n\n\n\n\n\n\n\n\n\n\n\n')

assert os.path.isfile('boilerplate/README.rst')
assert os.path.isfile('python_boilerplate/README.rst')

0 comments on commit ef981da

Please sign in to comment.