Skip to content

Commit f03ddd7

Browse files
authored
Merge pull request #28 from TTWShell/feature/pytest.ini
Feature/pytest.ini
2 parents cd9cea9 + dc3fc62 commit f03ddd7

File tree

9 files changed

+15
-18
lines changed

9 files changed

+15
-18
lines changed

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
cd ~/haha
6666
flask db init && flask db migrate && flask db upgrade
6767
flake8 . --exclude migrations
68-
py.test --cov . --cov-report term-missing -s
68+
py.test
6969
test-py36:
7070
docker:
7171
- image: circleci/python:3.6
@@ -97,7 +97,7 @@ jobs:
9797
cd ~/haha
9898
flask db init && flask db migrate && flask db upgrade
9999
flake8 . --exclude migrations
100-
py.test --cov . --cov-report term-missing -s
100+
py.test
101101
test-py37:
102102
docker:
103103
- image: circleci/python:3.7
@@ -131,7 +131,7 @@ jobs:
131131
cd ~/haha
132132
flask db init && flask db migrate && flask db upgrade
133133
flake8 . --exclude migrations
134-
py.test --cov . --cov-report term-missing -s
134+
py.test
135135
136136
workflows:
137137
version: 2
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[pytest]
2+
env =
3+
LASK_APP=app/run.py
4+
FLASK_ENV=testing
5+
addopts = --cov . --cov-report term-missing -s -x -v -p no:warnings

hobbit_core/hobbit/static/bootstrap/shire/tests/__init__.py.jinja2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class BaseTest:
2121
db.drop_all()
2222

2323
def setup_method(self, method):
24-
print('\n{}::{}'.format(type(self).__name__, method.__name__))
24+
pass
2525

2626
def teardown_method(self, method):
2727
for m in [m for m in db.Model._decl_class_registry.values()

pytest.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[pytest]
2+
addopts = --cov hobbit_core --cov=tests --cov-report term-missing -s -x -v -p no:warnings

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def gen_data(data_root='hobbit/static/bootstrap'):
2121

2222

2323
package_data = gen_data()
24-
assert len(package_data) == 26, \
24+
assert len(package_data) == 27, \
2525
'nums of tepl files error, {}'.format(len(package_data))
2626

2727

tests/__init__.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99
class BaseTest(object):
1010
root_path = os.path.split(os.path.abspath(__name__))[0]
1111

12-
def setup_method(self, method):
13-
print('\n{}::{}'.format(type(self).__name__, method.__name__))
14-
15-
def teardown_method(self, method):
16-
pass
17-
1812

1913
def rmdir(path):
2014
if os.path.exists(path):

tests/test_hobbit.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@ class TestHobbit(BaseTest):
1212

1313
def setup_method(self, method):
1414
rmdir(self.wkdir)
15-
super(TestHobbit, self).setup_method(method)
1615

1716
def teardown_method(self, method):
1817
os.chdir(self.root_path)
1918
rmdir(self.wkdir)
20-
super(TestHobbit, self).teardown_method(method)
2119

2220
def test_hobbit_cmd(self):
2321
runner = CliRunner()
@@ -88,7 +86,7 @@ def test_startproject_cmd_example(self):
8886
'--echo', 'startproject', '-n', 'haha', '--example',
8987
'-p', '1024',
9088
], obj={})
91-
# start + 26 files + 10 dir + 1 end + empty
92-
assert len(result.output.split('\n')) == 1 + 10 + 26 + 1 + 1
89+
# start + 27 files + 10 dir + 1 end + empty
90+
assert len(result.output.split('\n')) == 1 + 10 + 27 + 1 + 1
9391
assert result.exit_code == 0
9492
assert 'example.py' in result.output

tests/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def test_dict2object(self):
1919

2020
# test getattr
2121
with pytest.raises(AttributeError):
22-
print(obj.b)
22+
obj.b
2323

2424
def test_secure_filename(self):
2525
filenames = (

tests/views.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@
1010
@bp.route('/use_kwargs_with_partial/', methods=['POST'])
1111
@use_kwargs(UserSchema(partial=True))
1212
def use_kwargs_with_partial(**kwargs):
13-
print(kwargs)
1413
return jsonify({k: v or None for k, v in kwargs.items()})
1514

1615

1716
@bp.route('/use_kwargs_without_partial/', methods=['POST'])
1817
@use_kwargs(UserSchema())
1918
def use_kwargs_without_partial(**kwargs):
20-
print(kwargs)
2119
return jsonify({k: v or None for k, v in kwargs.items()})

0 commit comments

Comments
 (0)