Skip to content

Commit

Permalink
Merge 4ae93a7 into d4faa40
Browse files Browse the repository at this point in the history
  • Loading branch information
asottile committed Jul 8, 2018
2 parents d4faa40 + 4ae93a7 commit d79825e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 16 deletions.
1 change: 1 addition & 0 deletions changelog/2319.trivial.rst
@@ -0,0 +1 @@
Remove obsolete ``__future__`` imports.
13 changes: 3 additions & 10 deletions src/_pytest/_code/source.py
@@ -1,4 +1,4 @@
from __future__ import absolute_import, division, generators, print_function
from __future__ import absolute_import, division, print_function

import ast
from ast import PyCF_ONLY_AST as _AST_FLAG
Expand Down Expand Up @@ -152,12 +152,7 @@ def __str__(self):
return "\n".join(self.lines)

def compile(
self,
filename=None,
mode="exec",
flag=generators.compiler_flag,
dont_inherit=0,
_genframe=None,
self, filename=None, mode="exec", flag=0, dont_inherit=0, _genframe=None
):
""" return compiled code object. if filename is None
invent an artificial filename which displays
Expand Down Expand Up @@ -201,9 +196,7 @@ def compile(
#


def compile_(
source, filename=None, mode="exec", flags=generators.compiler_flag, dont_inherit=0
):
def compile_(source, filename=None, mode="exec", flags=0, dont_inherit=0):
""" compile the given source to a raw code object,
and maintain an internal cache which allows later
retrieval of the source code for the code object
Expand Down
3 changes: 1 addition & 2 deletions testing/python/raises.py
Expand Up @@ -33,8 +33,7 @@ def __call__(self):
def test_raises_as_contextmanager(self, testdir):
testdir.makepyfile(
"""
from __future__ import with_statement
import py, pytest
import pytest
import _pytest._code
def test_simple():
Expand Down
6 changes: 3 additions & 3 deletions testing/test_assertrewrite.py
Expand Up @@ -97,23 +97,23 @@ def test_place_initial_imports(self):
assert imp.lineno == 2
assert imp.col_offset == 0
assert isinstance(m.body[2], ast.Assign)
s = """from __future__ import with_statement\nother_stuff"""
s = """from __future__ import division\nother_stuff"""
m = rewrite(s)
assert isinstance(m.body[0], ast.ImportFrom)
for imp in m.body[1:3]:
assert isinstance(imp, ast.Import)
assert imp.lineno == 2
assert imp.col_offset == 0
assert isinstance(m.body[3], ast.Expr)
s = """'doc string'\nfrom __future__ import with_statement"""
s = """'doc string'\nfrom __future__ import division"""
m = rewrite(s)
adjust_body_for_new_docstring_in_module_node(m)
assert isinstance(m.body[0], ast.ImportFrom)
for imp in m.body[1:3]:
assert isinstance(imp, ast.Import)
assert imp.lineno == 2
assert imp.col_offset == 0
s = """'doc string'\nfrom __future__ import with_statement\nother"""
s = """'doc string'\nfrom __future__ import division\nother"""
m = rewrite(s)
adjust_body_for_new_docstring_in_module_node(m)
assert isinstance(m.body[0], ast.ImportFrom)
Expand Down
1 change: 0 additions & 1 deletion testing/test_capture.py
Expand Up @@ -2,7 +2,6 @@

# note: py.io capture tests where copied from
# pylib 1.4.20.dev2 (rev 13d9af95547e)
from __future__ import with_statement
import pickle
import os
import sys
Expand Down

0 comments on commit d79825e

Please sign in to comment.