Skip to content

Commit bded2b5

Browse files
committed
Fix requirements for ci, cover deprecation
1 parent 969f1b3 commit bded2b5

File tree

6 files changed

+85
-15
lines changed

6 files changed

+85
-15
lines changed

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ install:
1212
script: tox
1313
after_success:
1414
- coveralls
15-
before_deploy:
16-
- pip install -r CI_REQUIREMENTS.txt
1715
deploy:
1816
- provider: pypi
1917
distributions: sdist bdist_wheel

CI_REQUIREMENTS.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

logwrap/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
# pylint: disable=ungrouped-imports, no-name-in-module
3939
if six.PY34:
40-
from ._logwrap3 import logwrap, LogWrap, async_logwrap, AsyncLogWrap
40+
from ._log_wrap3 import logwrap, LogWrap, async_logwrap, AsyncLogWrap
4141

4242
__all__ += ('async_logwrap', 'AsyncLogWrap')
4343
else:
File renamed without changes.

test/test_log_wrap.py

Lines changed: 73 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,42 @@ def setUpClass(cls):
706706
)
707707
cls.loop = namespace['loop']
708708

709-
def test_coroutine_async(self, logger):
709+
@mock.patch('warnings.warn', autospec=True)
710+
def test_class_deprecation(self, warn, logger):
711+
namespace = {'logwrap': logwrap, 'loop': self.loop}
712+
713+
exec("""
714+
import asyncio
715+
716+
@logwrap.AsyncLogWrap
717+
@asyncio.coroutine
718+
def func():
719+
pass
720+
721+
loop.run_until_complete(func())
722+
""",
723+
namespace
724+
)
725+
# While we're not expanding result coroutine object from namespace,
726+
# do not check execution result
727+
logger.assert_has_calls((
728+
mock.call.log(
729+
level=logging.DEBUG,
730+
msg="Awaiting: \n'func'()"
731+
),
732+
mock.call.log(
733+
level=logging.DEBUG,
734+
msg="Done: 'func' with result:\nNone"
735+
)
736+
))
737+
738+
warn.assert_called_once_with(
739+
'AsyncLogWrap is deprecated. Functionality is merged into LogWrap',
740+
DeprecationWarning
741+
)
742+
743+
@mock.patch('warnings.warn', autospec=True)
744+
def test_func_deprecation(self, warn, logger):
710745
namespace = {'logwrap': logwrap, 'loop': self.loop}
711746

712747
exec("""
@@ -717,6 +752,40 @@ def test_coroutine_async(self, logger):
717752
def func():
718753
pass
719754
755+
loop.run_until_complete(func())
756+
""",
757+
namespace
758+
)
759+
# While we're not expanding result coroutine object from namespace,
760+
# do not check execution result
761+
logger.assert_has_calls((
762+
mock.call.log(
763+
level=logging.DEBUG,
764+
msg="Awaiting: \n'func'()"
765+
),
766+
mock.call.log(
767+
level=logging.DEBUG,
768+
msg="Done: 'func' with result:\nNone"
769+
)
770+
))
771+
772+
warn.assert_called_once_with(
773+
'async_logwrap is deprectaed. '
774+
'Functionality is merged into logwrap',
775+
DeprecationWarning
776+
)
777+
778+
def test_coroutine_async(self, logger):
779+
namespace = {'logwrap': logwrap, 'loop': self.loop}
780+
781+
exec("""
782+
import asyncio
783+
784+
@logwrap.logwrap
785+
@asyncio.coroutine
786+
def func():
787+
pass
788+
720789
loop.run_until_complete(func())
721790
""",
722791
namespace
@@ -748,7 +817,7 @@ def test_coroutine_async_as_argumented(self, logger):
748817
exec("""
749818
import asyncio
750819
751-
@logwrap.async_logwrap(log=new_logger)
820+
@logwrap.logwrap(log=new_logger)
752821
@asyncio.coroutine
753822
def func():
754823
pass
@@ -776,7 +845,7 @@ def test_coroutine_fail(self, logger):
776845
exec("""
777846
import asyncio
778847
779-
@logwrap.async_logwrap
848+
@logwrap.logwrap
780849
@asyncio.coroutine
781850
def func():
782851
raise Exception('Expected')
@@ -815,7 +884,7 @@ def test_exceptions_blacklist(self, logger):
815884
exec("""
816885
import asyncio
817886
818-
@logwrap.async_logwrap(log=new_logger, blacklisted_exceptions=[TypeError])
887+
@logwrap.logwrap(log=new_logger, blacklisted_exceptions=[TypeError])
819888
@asyncio.coroutine
820889
def func():
821890
raise TypeError('Blacklisted')

tox.ini

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,20 @@ deps =
1818
pytest
1919
pytest-cov
2020
pytest-sugar
21-
py27: funcsigs>=1.0
22-
pypy: funcsigs>=1.0
2321
py27: mock
2422
pypy: mock
25-
py34: typing
23+
{[base_deps]deps}
2624

2725
commands =
2826
py.test -vv --junitxml=unit_result.xml --cov-config .coveragerc --cov-report html --cov=logwrap {posargs:test}
2927
coverage report --fail-under 90
3028

29+
[base_deps]
30+
deps =
31+
py27: funcsigs>=1.0
32+
pypy: funcsigs>=1.0
33+
py34: typing
34+
3135
[testenv:venv]
3236
commands = {posargs:}
3337

@@ -52,15 +56,15 @@ commands = pep257 logwrap
5256

5357
[testenv:install]
5458
deps =
55-
-r{toxinidir}/CI_REQUIREMENTS.txt
59+
{[base_deps]deps}
5660
usedevelop = False
5761
commands = pip install ./ -vvv -U
5862

5963
[testenv:pylint]
6064
basepython = python3.5
6165
deps =
6266
pylint
63-
-r{toxinidir}/CI_REQUIREMENTS.txt
67+
funcsigs>=1.0
6468
commands = pylint logwrap
6569

6670
[flake8]
@@ -84,14 +88,14 @@ count = True
8488
[testenv:docs]
8589
deps =
8690
sphinx
87-
-r{toxinidir}/CI_REQUIREMENTS.txt
91+
{[base_deps]deps}
8892
commands = python setup.py build_sphinx
8993

9094
[testenv:upload_docs]
9195
deps =
9296
sphinx
9397
sphinx-pypi-upload
94-
-r{toxinidir}/CI_REQUIREMENTS.txt
98+
{[base_deps]deps}
9599
commands = python setup.py build_sphinx upload_sphinx
96100

97101
[testenv:bandit]

0 commit comments

Comments
 (0)