Skip to content

test_validators.py, line 1369: fixture 'self' not found #562

@tbenst

Description

@tbenst

I'm trying to update jsonschema for NixOS, and am having trouble running the tests using pytest jsonschema/tests:

============================= test session starts ==============================
platform linux -- Python 3.7.3, pytest-4.2.1, py-1.7.0, pluggy-0.8.1
rootdir: /build/jsonschema-3.0.1, inifile:
collected 2148 items

jsonschema/tests/test_cli.py ......                                      [  0%]
jsonschema/tests/test_exceptions.py ..............................       [  1%]
jsonschema/tests/test_format.py .......                                  [  2%]
jsonschema/tests/test_jsonschema_test_suite.py ......................... [  3%]
................................................................ssssss.. [  6%]
.....ssss..ssss......................................................... [  9%]
........................................................................ [ 13%]
........................................................................ [ 16%]
........................................................................ [ 19%]
...........................ssssssssssssssssssssssssssss................. [ 23%]
........................................................................ [ 26%]
...........................................ssss.........ss.............. [ 29%]
........................................................................ [ 33%]
........................................................................ [ 36%]
........................................................................ [ 40%]
.......................ssss.........ssssssssssssssssssssssssssssssssssss [ 43%]
ssssssssssssssssssssssssssssssss........................................ [ 46%]
........................................................................ [ 50%]
.......................................ssss.........ss.................. [ 53%]
........................................................................ [ 56%]
........................................................................ [ 60%]
...............................................sssssssss................ [ 63%]
........................................................................ [ 66%]
..ssssssssssssssss.................ssssssssssssssssssssssssssssssss..... [ 70%]
........................................................................ [ 73%]
...................................................ssss.........ss...... [ 76%]
.....................sssss.......sss.................................... [ 80%]
....................................ssssssssssssssssssssssssssssss...... [ 83%]
........................................................................ [ 86%]
......................................................                   [ 89%]
jsonschema/tests/test_types.py .............                             [ 90%]
jsonschema/tests/test_validators.py .................................... [ 91%]
.......................s.s......................s..s.s.................. [ 95%]
s...................s...................s.............................E. [ 98%]
.................................                                        [100%]

==================================== ERRORS ====================================
____________________________ ERROR at setup of test ____________________________
file /build/jsonschema-3.0.1/jsonschema/tests/test_validators.py, line 1369
          def test(self, checker=checker, format=format):
E       fixture 'self' not found
>       available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.

/build/jsonschema-3.0.1/jsonschema/tests/test_validators.py:1369
=============================== warnings summary ===============================
jsonschema/tests/test_validators.py::TestValidate::test_schema_error_message
  /build/jsonschema-3.0.1/jsonschema/tests/test_validators.py:1562: DeprecationWarning: Please use assertRegex instead.
    "(?s)Failed validating u?'.*' in metaschema.*On schema",

jsonschema/tests/test_validators.py::TestValidate::test_validation_error_message
  /build/jsonschema-3.0.1/jsonschema/tests/test_validators.py:1554: DeprecationWarning: Please use assertRegex instead.
    "(?s)Failed validating u?'.*' in schema.*On instance",

-- Docs: https://docs.pytest.org/en/latest/warnings.html
======== 1912 passed, 235 skipped, 2 warnings, 1 error in 3.62 seconds =========

And here's the results of pytest --fixtures jsonschema/tests:

============================= test session starts ==============================
platform linux -- Python 3.7.3, pytest-4.2.1, py-1.7.0, pluggy-0.8.1
rootdir: /build/jsonschema-3.0.1, inifile:
collected 2148 items
cache
    Return a cache object that can persist state between testing sessions.

    cache.get(key, default)
    cache.set(key, value)

    Keys must be a ``/`` separated value, where the first part is usually the
    name of your plugin or application to avoid clashes with other cache users.

    Values can be any object handled by the json stdlib module.
capsys
    Enable capturing of writes to ``sys.stdout`` and ``sys.stderr`` and make
    captured output available via ``capsys.readouterr()`` method calls
    which return a ``(out, err)`` namedtuple.  ``out`` and ``err`` will be ``text``
    objects.
capsysbinary
    Enable capturing of writes to ``sys.stdout`` and ``sys.stderr`` and make
    captured output available via ``capsys.readouterr()`` method calls
    which return a ``(out, err)`` tuple.  ``out`` and ``err`` will be ``bytes``
    objects.
capfd
    Enable capturing of writes to file descriptors ``1`` and ``2`` and make
    captured output available via ``capfd.readouterr()`` method calls
    which return a ``(out, err)`` tuple.  ``out`` and ``err`` will be ``text``
    objects.
capfdbinary
    Enable capturing of write to file descriptors 1 and 2 and make
    captured output available via ``capfdbinary.readouterr`` method calls
    which return a ``(out, err)`` tuple.  ``out`` and ``err`` will be
    ``bytes`` objects.
doctest_namespace
    Fixture that returns a :py:class:`dict` that will be injected into the namespace of doctests.
pytestconfig
    Session-scoped fixture that returns the :class:`_pytest.config.Config` object.

    Example::

        def test_foo(pytestconfig):
            if pytestconfig.getoption("verbose"):
                ...
record_property
    Add an extra properties the calling test.
    User properties become part of the test report and are available to the
    configured reporters, like JUnit XML.
    The fixture is callable with ``(name, value)``, with value being automatically
    xml-encoded.

    Example::

        def test_function(record_property):
            record_property("example_key", 1)
record_xml_attribute
    Add extra xml attributes to the tag for the calling test.
    The fixture is callable with ``(name, value)``, with value being
    automatically xml-encoded
caplog
    Access and control log capturing.

    Captured logs are available through the following properties/methods::

    * caplog.text            -> string containing formatted log output
    * caplog.records         -> list of logging.LogRecord instances
    * caplog.record_tuples   -> list of (logger_name, level, message) tuples
    * caplog.clear()         -> clear captured records and formatted log output string
monkeypatch
    The returned ``monkeypatch`` fixture provides these
    helper methods to modify objects, dictionaries or os.environ::

        monkeypatch.setattr(obj, name, value, raising=True)
        monkeypatch.delattr(obj, name, raising=True)
        monkeypatch.setitem(mapping, name, value)
        monkeypatch.delitem(obj, name, raising=True)
        monkeypatch.setenv(name, value, prepend=False)
        monkeypatch.delenv(name, raising=True)
        monkeypatch.syspath_prepend(path)
        monkeypatch.chdir(path)

    All modifications will be undone after the requesting
    test function or fixture has finished. The ``raising``
    parameter determines if a KeyError or AttributeError
    will be raised if the set/deletion operation has no target.
recwarn
    Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions.

    See http://docs.python.org/library/warnings.html for information
    on warning categories.
tmpdir_factory
    Return a :class:`_pytest.tmpdir.TempdirFactory` instance for the test session.
tmp_path_factory
    Return a :class:`_pytest.tmpdir.TempPathFactory` instance for the test session.
tmpdir
    Return a temporary directory path object
    which is unique to each test function invocation,
    created as a sub directory of the base temporary
    directory.  The returned object is a `py.path.local`_
    path object.

    .. _`py.path.local`: https://py.readthedocs.io/en/latest/path.html
tmp_path
    Return a temporary directory path object
    which is unique to each test function invocation,
    created as a sub directory of the base temporary
    directory.  The returned object is a :class:`pathlib.Path`
    object.

    .. note::

        in python < 3.6 this is a pathlib2.Path

========================= no tests ran in 1.56 seconds =========================

Any tips? Thanks so much!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions