Skip to content

Commit

Permalink
Merge pull request #35 from renanivo/drop-python-2
Browse files Browse the repository at this point in the history
Drop python 2
  • Loading branch information
renanivo authored Jul 29, 2020
2 parents 1159d68 + 96d66b9 commit 02f20e6
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 68 deletions.
6 changes: 0 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
dist: xenial
language: python
python:
- 2.7
- 3.5
- 3.6
- 3.7
Expand All @@ -15,11 +14,6 @@ env:
- PYTEST="pytest>=4.0.0,<5.0.0"
- PYTEST="pytest>=5.0.0,<6.0.0"

matrix:
exclude:
- python: 2.7
env: PYTEST="pytest>=5.0.0,<6.0.0"

cache:
directories:
- $HOME/.cache/pip
Expand Down
1 change: 0 additions & 1 deletion pytest_testdox/constants.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# -*- coding: utf-8 -*-
TITLE_MARK = 'it'
CLASS_NAME_MARK = 'describe'
9 changes: 3 additions & 6 deletions pytest_testdox/formatters.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import os
import re

Expand Down Expand Up @@ -78,11 +75,11 @@ def _remove_patterns(statement, patterns):
pattern = glob_pattern.replace('*', '')

if glob_pattern.startswith('*'):
pattern = '{0}$'.format(pattern)
pattern = '{}$'.format(pattern)
statement = re.sub(pattern, '', statement)

elif glob_pattern.endswith('*'):
pattern = '^{0}'.format(pattern)
pattern = '^{}'.format(pattern)
statement = re.sub(pattern, '', statement)

elif '*' in glob_pattern:
Expand All @@ -92,7 +89,7 @@ def _remove_patterns(statement, patterns):
statement = _remove_patterns(statement, infix_patterns)

else:
pattern = '^{0}'.format(pattern)
pattern = '^{}'.format(pattern)
statement = re.sub(pattern, '', statement)

return statement
Expand Down
13 changes: 3 additions & 10 deletions pytest_testdox/models.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from collections import namedtuple

import six

from . import formatters

PatternConfig = namedtuple('PatternConfig', 'files functions classes')


@six.python_2_unicode_compatible
class Node(object):
class Node:

def __init__(self, title, class_name, module_name):
self.title = title
Expand Down Expand Up @@ -74,8 +68,7 @@ def parse(cls, nodeid, pattern_config, title=None, class_name=None):
return cls(title=title, class_name=class_name, module_name=module_name)


@six.python_2_unicode_compatible
class Result(object):
class Result:

_OUTCOME_REPRESENTATION = {
'passed': ' [x] ',
Expand Down Expand Up @@ -105,7 +98,7 @@ def __str__(self):
outcome_representation=representation,
node=formatters.pad_text_to_characters(
characters=representation,
text=six.text_type(self.node)
text=str(self.node)
)
)

Expand Down
5 changes: 1 addition & 4 deletions pytest_testdox/plugin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import sys

import pytest
Expand Down Expand Up @@ -81,7 +78,7 @@ def pytest_runtest_makereport(item, call):
class TestdoxTerminalReporter(TerminalReporter):

def __init__(self, config, file=None):
TerminalReporter.__init__(self, config, file)
super().__init__(config, file)
self._last_header = None
self.pattern_config = models.PatternConfig(
files=self.config.getini('python_files'),
Expand Down
9 changes: 2 additions & 7 deletions pytest_testdox/wrappers.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import six

from . import formatters


class Wrapper(object):
class Wrapper:

def __init__(self, wrapped):
self.wrapped = wrapped
Expand Down Expand Up @@ -54,6 +49,6 @@ def __str__(self):
outcome=outcome,
node=formatters.pad_text_to_characters(
characters=outcome,
text=six.text_type(self.wrapped.node)
text=str(self.wrapped.node)
)
)
1 change: 0 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
bumpversion==0.5.3
flake8==3.7.8
isort==4.3.21
mock==3.0.5
pytest-cov==2.7.1
pytest>=3.7.0
14 changes: 6 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os

from setuptools import setup
Expand All @@ -22,26 +21,25 @@ def read(fname):
keywords='pytest testdox test report bdd',
install_requires=[
'pytest>=3.7.0',
'six>=1.11.0',
],
packages=['pytest_testdox'],
python_requires=">=3.5",
classifiers=[
'Development Status :: 5 - Production/Stable',
'Framework :: Pytest',
'Intended Audience :: Developers',
'Topic :: Software Development :: Testing',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Operating System :: OS Independent',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Topic :: Software Development :: Testing',
],
entry_points={
'pytest11': [
Expand Down
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
import os
import warnings

Expand Down
15 changes: 6 additions & 9 deletions tests/test_formatters.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import os

import pytest

from pytest_testdox import formatters


class TestFormatTitle(object):
class TestFormatTitle:

@pytest.fixture
def patterns(self):
Expand All @@ -26,7 +23,7 @@ def test_should_remove_test_pattern(self, patterns):
)


class TestFormatClassName(object):
class TestFormatClassName:

@pytest.fixture
def patterns(self):
Expand Down Expand Up @@ -58,7 +55,7 @@ def test_should_not_split_letters_in_an_abbreviation(
assert formatted == expected


class TestFormatModuleName(object):
class TestFormatModuleName:

@pytest.fixture
def patterns(self):
Expand Down Expand Up @@ -97,7 +94,7 @@ def test_should_remove_infix_glob_patterns(self):
assert formatted == 'module'


class TestFormatMultiLineText(object):
class TestFormatMultiLineText:

def test_should_strip_spaces_from_begin_and_end(self):
assert formatters.format_multi_line_text(' works ') == 'works'
Expand All @@ -112,7 +109,7 @@ def test_should_srip_spaces_from_multiple_lines(self):
)


class TestJustifyTextToCharacter(object):
class TestJustifyTextToCharacter:

def test_should_not_pad_single_line_text(self):
assert formatters.pad_text_to_characters('>>>', 'some text') == (
Expand Down Expand Up @@ -141,7 +138,7 @@ def test_should_pad_the_following_lines_to_the_width_of_given_characters(
)


class TestIncludeParametrized(object):
class TestIncludeParametrized:

def test_should_return_title_when_no_parameters_are_found(self):
assert formatters.include_parametrized(
Expand Down
1 change: 0 additions & 1 deletion tests/test_markers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
import pytest


Expand Down
9 changes: 3 additions & 6 deletions tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import os
from unittest import mock

import mock
import pytest

from pytest_testdox import formatters
Expand Down Expand Up @@ -33,7 +30,7 @@ def pattern_config():
)


class TestNode(object):
class TestNode:

def test_parse_should_return_a_node_instance(self, pattern_config):
nodeid = 'tests/test_module.py::test_title'
Expand Down Expand Up @@ -112,7 +109,7 @@ def test_should_not_be_equal_when_it_is_not_the_same_class(self, node):
assert node != other


class TestResult(object):
class TestResult:

@pytest.fixture
def result(self, node):
Expand Down
13 changes: 5 additions & 8 deletions tests/test_plugin.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import pytest

from pytest_testdox import constants


class TestReport(object):
class TestReport:

@pytest.fixture
def testdir(self, testdir):
Expand Down Expand Up @@ -79,11 +76,11 @@ def test_a_feature_is_working():

def test_should_print_the_test_class_name(self, testdir):
testdir.makepyfile("""
class TestFoo(object):
class TestFoo:
def test_foo(self):
pass
class TestBar(object):
class TestBar:
def test_bar(self):
pass
""")
Expand Down Expand Up @@ -124,7 +121,7 @@ def test_should_use_python_patterns_configuration(self, testdir):
python_functions=it*
""")
testdir.makefile('.py', module_spec="""
class DescribeTest(object):
class DescribeTest:
def it_runs(self):
pass
""")
Expand Down Expand Up @@ -166,7 +163,7 @@ def test_should_override_class_names_with_class_name_mark(
My Class
My precious class
''')
class TestClass(object):
class TestClass:
def test_foo(self):
pass
Expand Down

0 comments on commit 02f20e6

Please sign in to comment.