Skip to content

Commit

Permalink
Merge pull request #1 from nicoddemus/pytest-3
Browse files Browse the repository at this point in the history
Support and require pytest>=3.0
  • Loading branch information
tomviner authored Dec 17, 2016
2 parents ec32b3a + b0870b3 commit edb9cb3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Take a trivial test like:
def test_simple():
a = 1
b = 2
assert 1 + 2 == 3
assert a + b == 3
View the rewritten AST as Python like this:

Expand Down
10 changes: 5 additions & 5 deletions pytest_ast_back_to_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from __future__ import print_function

from _pytest.assertion.rewrite import rewrite_asserts
from _pytest.monkeypatch import monkeypatch
from _pytest.monkeypatch import MonkeyPatch

import codegen

Expand All @@ -22,9 +22,9 @@ def pytest_configure(config):
config.pluginmanager.register(config._ast_as_python)

def make_replacement_rewrite_asserts(store):
def replacement_rewrite_asserts(tree):
rewrite_asserts(tree)
store.append(codegen.to_source(tree))
def replacement_rewrite_asserts(mod, module_path=None, config=None):
rewrite_asserts(mod, module_path, config)
store.append(codegen.to_source(mod))
return replacement_rewrite_asserts

class AstAsPython(object):
Expand All @@ -35,7 +35,7 @@ def pytest_configure(self, config):
if not config.getoption('ast_as_python'):
return

mp = monkeypatch()
mp = MonkeyPatch()
mp.setattr(
'_pytest.assertion.rewrite.rewrite_asserts',
make_replacement_rewrite_asserts(self.store))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def read(fname):
description='A plugin for pytest devs to view how assertion rewriting recodes the AST',
long_description=read('README.rst'),
py_modules=['pytest_ast_back_to_python', 'codegen'],
install_requires=['pytest>=2.8.1'],
install_requires=['pytest>=3.0.0'],
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
Expand Down

0 comments on commit edb9cb3

Please sign in to comment.