diff options
author | Chris Dent <chris.dent@gmail.com> | 2018-10-23 16:09:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-23 16:09:42 +0100 |
commit | 9a873a24759f69d6414042abdfc2fde21f8cca21 (patch) | |
tree | 953b5c70cc968b523e42e7bf0594b8ac49216b9d /tests/test_wsgilib.py | |
parent | 95efbbf0137de2f0e472ca12d60cfe242c01ec27 (diff) | |
parent | 0604a3a5fd1a64098cbdaf44bbb76b805c5233c0 (diff) | |
download | paste-git-9a873a24759f69d6414042abdfc2fde21f8cca21.tar.gz |
Merge pull request #1 from cdent/pytest
Switch from nose to pytest
Diffstat (limited to 'tests/test_wsgilib.py')
-rw-r--r-- | tests/test_wsgilib.py | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/tests/test_wsgilib.py b/tests/test_wsgilib.py index 72573cf..e6514ef 100644 --- a/tests/test_wsgilib.py +++ b/tests/test_wsgilib.py @@ -1,3 +1,5 @@ +import pytest + from paste.wsgilib import add_close @@ -18,35 +20,22 @@ def close_func(): close_func_called = True -def test_add_close_bytes(): - global close_func_called - - close_func_called = False - lst = [] - app_iterable = app_iterable_func_bytes() - - obj = add_close(app_iterable, close_func) - for x in obj: - lst.append(x) - obj.close() - - assert lst == [b'a', b'b', b'c'] - assert close_func_called - assert obj._closed - - -def test_add_close_unicode(): +@pytest.mark.parametrize("app_iterable_func,expected", [ + (app_iterable_func_bytes, [b'a', b'b', b'c']), + (app_iterable_func_unicode, ['a', 'b', 'c']), +]) +def test_add_close(app_iterable_func, expected): global close_func_called close_func_called = False lst = [] - app_iterable = app_iterable_func_unicode() + app_iterable = app_iterable_func() obj = add_close(app_iterable, close_func) for x in obj: lst.append(x) obj.close() - assert lst == ['a', 'b', 'c'] + assert lst == expected assert close_func_called assert obj._closed |