Skip to content

Commit

Permalink
Version 1.1.0 (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
tolstislon committed Apr 13, 2022
1 parent eefb8ad commit b981372
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 74 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: pytest-bug

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.6", "3.7", "3.8", "3.9", "3.10" ]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest black pytest-cov
python -m pip install -e .
- name: Black
run: |
black --check pytest_bug
- name: Test with pytest
run: |
pytest tests
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,6 @@ gfgfg.py

# autogenerated
pytest_bug/__version__.py
Pipfile.lock
Pipfile.lock
pyproject.toml
build.sh
46 changes: 0 additions & 46 deletions .travis.yml

This file was deleted.

9 changes: 5 additions & 4 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
pytest = "==6.1.2"
pytest-cov = "==2.10.1"
black = "==20.8b1"
pytest = "==7.1.1"
pytest-cov = "==3.0.0"
black = "==22.3.0"

[packages]
pytest-bug = {editable = true, path = "."}

[requires]
python_version = "3.8"
python_version = "3.10"

[pipenv]
allow_prereleases = true
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# pytest-bug

[![PyPI](https://img.shields.io/pypi/v/pytest-bug.svg?color=%2301a001&label=pypi)](https://pypi.org/project/pytest-bug/)
[![Build Status](https://travis-ci.com/tolstislon/pytest-bug.svg?branch=master)](https://travis-ci.com/tolstislon/pytest-bug)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pytest-bug.svg)](https://pypi.org/project/pytest-bug/)
[![pytes_support](https://img.shields.io/badge/pytest-%3E%3D3.6.0-blue.svg)](https://github.com/pytest-dev/pytest/releases)
[![pytes_support](https://img.shields.io/badge/pytest-%3E%3D6.2.0-blue.svg)](https://github.com/pytest-dev/pytest/releases)
[![Downloads](https://pepy.tech/badge/pytest-bug)](https://pepy.tech/project/pytest-bug)
[![codecov](https://codecov.io/gh/tolstislon/pytest-bug/branch/master/graph/badge.svg)](https://codecov.io/gh/tolstislon/pytest-bug)

Expand Down
18 changes: 9 additions & 9 deletions pytest_bug/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ def __init__(self, comment: str = "no comment", run: bool = False):
:param comment: str
:param run: bool
"""
self.comment = "{}{}".format(START_COMMENT, comment)
self.comment = f"{START_COMMENT}{comment}"
self.run = run


class ReportBug:
letter = "u" # type: str
word = "BUG-UNKNOWN" # type:str
markup = {} # type: Dict[str, bool]
letter: str = "u"
word: str = "BUG-UNKNOWN"
markup: Dict[str, bool] = {}

def __init__(self, comment):
self.comment = comment
Expand Down Expand Up @@ -178,7 +178,7 @@ def _bug_mark(self, *args, run: bool = False, **kwargs) -> Tuple[str, bool]:
:return: Tuple[str, bool]
"""
comment = [str(i) for i in args]
comment.extend("{}={}".format(key, value) for key, value in kwargs.items())
comment.extend(f"{key}={value}" for key, value in kwargs.items())
if self._all_run:
run = True
elif self._all_skip:
Expand Down Expand Up @@ -240,7 +240,7 @@ def pytest_collection_modifyitems(self, items, config):
for item in items:
mark_bug = getattr(item, MARK_BUG, None)
if mark_bug is not None:
comment = mark_bug.comment[len(START_COMMENT):]
comment = mark_bug.comment[len(START_COMMENT) :]
if re.search(bug_pattern, comment, re.I):
selected_items.append(item)
config.hook.pytest_deselected(
Expand Down Expand Up @@ -284,10 +284,10 @@ def pytest_terminal_summary(self, terminalreporter):
):
text = []
if self._skipped:
text.append("Bugs skipped: {}".format(self._skipped))
text.append(f"Bugs skipped: {self._skipped}")
if self._passed:
text.append("Bugs passed: {}".format(self._passed))
text.append(f"Bugs passed: {self._passed}")
if self._failed:
text.append("Bugs failed: {}".format(self._failed))
text.append(f"Bugs failed: {self._failed}")
if text:
terminalreporter.write_sep("-", " ".join(text))
9 changes: 4 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
author_email="tolstislon@gmail.com",
url="https://github.com/tolstislon/pytest-bug",
packages=find_packages(exclude=("tests",)),
install_requires=["pytest>=3.6.0"],
version='1.1.0',
install_requires=["pytest>=6.2.0"],
include_package_data=True,
use_scm_version={"write_to": "pytest_bug/__version__.py"},
setup_requires=["setuptools_scm"],
python_requires=">=3.5",
python_requires=">=3.6",
license="MIT License",
entry_points={"pytest11": ["pytest_bug = pytest_bug.plugin"]},
keywords=["pytest"],
Expand All @@ -30,11 +29,11 @@
"Operating System :: OS Independent",
"Framework :: Pytest",
"Programming Language :: Python",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Testing",
"Topic :: Software Development :: Quality Assurance",
Expand Down
1 change: 0 additions & 1 deletion tests/pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ addopts =
-p no:logging
--cov=pytest_bug tests
--cov-branch
--cov-report=xml

pytester_example_dir = .

Expand Down
12 changes: 6 additions & 6 deletions tests/test_markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@pytest.mark.parametrize('test_import, test_mark', PARAMETRIZE)
def test_mark_func_and_class(testdir, test_import, test_mark):
testdir.makepyfile(
"""
f"""
{test_import}
@{test_mark}bug('skip')
Expand Down Expand Up @@ -42,7 +42,7 @@ def test_one(self):
def test_two(self):
assert True
""".format(test_import=test_import, test_mark=test_mark)
"""
)
result = testdir.runpytest()
assert result.ret == 0
Expand All @@ -55,7 +55,7 @@ def test_two(self):
@pytest.mark.parametrize('test_import, test_mark', PARAMETRIZE)
def test_mark_module_no_run(testdir, test_import, test_mark):
testdir.makepyfile(
"""
f"""
{test_import}
pytestmark = {test_mark}bug('skip file')
Expand All @@ -65,7 +65,7 @@ def test_one():
def test_two():
assert True
""".format(test_import=test_import, test_mark=test_mark)
"""
)
result = testdir.runpytest()
assert result.ret == 0
Expand All @@ -78,7 +78,7 @@ def test_two():
@pytest.mark.parametrize('test_import, test_mark', PARAMETRIZE)
def test_mark_module_run_true(testdir, test_import, test_mark):
testdir.makepyfile(
"""
f"""
{test_import}
pytestmark = {test_mark}bug('file bug', run=True)
Expand All @@ -88,7 +88,7 @@ def test_one():
def test_two():
assert True
""".format(test_import=test_import, test_mark=test_mark)
"""
)
result = testdir.runpytest()
assert result.ret == 0
Expand Down

0 comments on commit b981372

Please sign in to comment.