8
8
import datetime
9
9
import os
10
10
import subprocess
11
- import sys
12
11
from cookiecutter .utils import rmtree
13
12
14
13
@@ -34,6 +33,7 @@ def bake_in_temp_dir(cookies, *args, **kwargs):
34
33
cookie to be baked and its temporal files will be removed
35
34
"""
36
35
result = cookies .bake (* args , ** kwargs )
36
+
37
37
try :
38
38
yield result
39
39
finally :
@@ -80,15 +80,15 @@ def test_bake_with_defaults(cookies):
80
80
81
81
found_toplevel_files = [f .basename for f in result .project .listdir ()]
82
82
assert "setup.py" in found_toplevel_files
83
- assert "pysteps_importer_abc " in found_toplevel_files
83
+ assert "pysteps_importer_institution_name " in found_toplevel_files
84
84
assert "tox.ini" in found_toplevel_files
85
85
assert "tests" in found_toplevel_files
86
86
87
87
88
88
def test_bake_and_run_tests (cookies ):
89
89
with bake_in_temp_dir (cookies ) as result :
90
90
assert result .project .isdir ()
91
- assert run_inside_dir ("python setup.py test " , str (result .project )) == 0
91
+ assert run_inside_dir ("pytest " , str (result .project )) == 0
92
92
93
93
94
94
def test_bake_withspecialchars_and_run_tests (cookies ):
@@ -97,14 +97,14 @@ def test_bake_withspecialchars_and_run_tests(cookies):
97
97
cookies , extra_context = {"full_name" : 'name "quote" name' }
98
98
) as result :
99
99
assert result .project .isdir ()
100
- assert run_inside_dir ("python setup.py test " , str (result .project )) == 0
100
+ assert run_inside_dir ("pytest " , str (result .project )) == 0
101
101
102
102
103
103
def test_bake_with_apostrophe_and_run_tests (cookies ):
104
104
"""Ensure that a `full_name` with apostrophes does not break setup.py"""
105
105
with bake_in_temp_dir (cookies , extra_context = {"full_name" : "O'connor" }) as result :
106
106
assert result .project .isdir ()
107
- assert run_inside_dir ("python setup.py test " , str (result .project )) == 0
107
+ assert run_inside_dir ("pytest " , str (result .project )) == 0
108
108
109
109
110
110
def test_bake_selecting_license (cookies ):
@@ -137,9 +137,9 @@ def test_bake_not_open_source(cookies):
137
137
def test_using_pytest (cookies ):
138
138
with bake_in_temp_dir (cookies , extra_context = {"use_pytest" : "y" }) as result :
139
139
assert result .project .isdir ()
140
- test_file_path = result .project .join ("tests/test_pysteps_importer_abc .py" )
140
+ test_file_path = result .project .join ("tests/test_pysteps_importer_institution_name .py" )
141
141
lines = test_file_path .readlines ()
142
142
# Test the new pytest target
143
- assert run_inside_dir ("python setup.py pytest" , str (result .project )) == 0
143
+ assert run_inside_dir ("pytest" , str (result .project )) == 0
144
144
# Test the test alias (which invokes pytest)
145
- assert run_inside_dir ("python setup.py test " , str (result .project )) == 0
145
+ assert run_inside_dir ("pytest " , str (result .project )) == 0
0 commit comments