Skip to content

AttributeError: 'flake8' not a registered marker with --strict --flake8 #2455

Description

@alex-dr

I don't know enough about the codebase to understand this, but 3.1 introduces a regression that prevents --strict and --flake8 flags from being passed simultaneously. This broke many builds across a few repositories until we restricted our pytest dependencies to <3.1.

Here is the error:

~/workspace/flake-fail$ py.test --strict --flake8
======================================== test session starts ========================================
platform linux2 -- Python 2.7.13, pytest-3.1.1, py-1.4.33, pluggy-0.4.0
rootdir: /home/alex/workspace/flake-fail, inifile: setup.cfg
plugins: flake8-0.8.1
collected 0 items / 1 errors 

============================================== ERRORS ===============================================
_________________________________________ ERROR collecting  _________________________________________
../../.virtualenvs/flail/local/lib/python2.7/site-packages/pytest_flake8.py:71: in pytest_collect_file
    statistics=config._flake8statistics)
../../.virtualenvs/flail/local/lib/python2.7/site-packages/pytest_flake8.py:89: in __init__
    self.add_marker("flake8")
../../.virtualenvs/flail/local/lib/python2.7/site-packages/_pytest/main.py:383: in add_marker
    marker = getattr(MARK_GEN, marker)
../../.virtualenvs/flail/local/lib/python2.7/site-packages/_pytest/mark.py:251: in __getattr__
    self._check(name)
../../.virtualenvs/flail/local/lib/python2.7/site-packages/_pytest/mark.py:266: in _check
    raise AttributeError("%r not a registered marker" % (name,))
E   AttributeError: 'flake8' not a registered marker
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
====================================== 1 error in 0.13 seconds ======================================

Minimal reproduction example:

# File: setup.py
from setuptools import setup


install_requirements = [
    'pytest-flake8',
    'pytest>=3.1',
    'six',
]

setup(name='flail',
      version='0.0.0',
      install_requires=install_requirements,
      )
mkvirtualenv flail
pip install .
py.test  # okay
py.test --strict  # okay
py.test --flake8  # okay
py.test --strict --flake8  # fail
pip install 'pytest<3.1'
py.test --strict --flake8  # okay
pip list:
configparser (3.5.0)
enum34 (1.1.6)
flail (0.0.0)
flake8 (3.3.0)
mccabe (0.6.1)
pip (9.0.1)
pkg-resources (0.0.0)
py (1.4.33)
pycodestyle (2.3.1)
pyflakes (1.5.0)
pytest (3.1.1)
pytest-flake8 (0.8.1)
setuptools (36.0.0)
six (1.10.0)
wheel (0.29.0)

Operating System: Ubuntu 17.04 (also observed on earlier versions)
Bug present in: 3.1.0, 3.1.1

  • Include a detailed description of the bug or suggestion
  • pip list of the virtual environment you are using
  • pytest and operating system versions
  • Minimal example if possible

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions