aragilar / pytest-mpi

Pytest plugin for working with MPI
https://pytest-mpi.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
19 stars 7 forks source link

selftest AttributeError: no attribute '--runpytest', 'monkeypatch' #4

Closed drew-parsons closed 4 years ago

drew-parsons commented 4 years ago

Running pytest-mpi's tests using pytest fails, with two types of error found:

AttributeError: 'Namespace' object has no attribute '--runpytest'
AttributeError: 'MPITestdir' object has no attribute 'monkeypatch'

This is on Debian unstable with pytest 4.6.9.

Full log:

$ pytest-3
=============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.8.2, pytest-4.6.9, py-1.8.1, pluggy-0.13.0
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/home/projects/python/build/pytest-mpi/tests/.hypothesis/examples')
rootdir: /home/projects, inifile: pytest.ini
plugins: mpi-0+unknown, flaky-3.6.1, remotedata-0.3.2, cov-2.8.1, doctestplus-0.5.0, hypothesis-4.36.2, astropy-header-0.1.2, arraydiff-0.3, openfiles-0.4.0
collected 10 items                                                                                                                                                                                                

test_fixtures.py EEEEEE                                                                                                                                                                                     [ 30%]
test_markers.py EEEEEEEEEEE                                                                                                                                                                                 [100%]

===================================================================================================== ERRORS ======================================================================================================
______________________________________________________________________________________ ERROR at setup of test_mpi_file_name _______________________________________________________________________________________

self = <_pytest.config.Config object at 0x7f426cc55160>, name = '--runpytest', default = <NOTSET>, skip = False

    def getoption(self, name, default=notset, skip=False):
        """ return command line option value.

        :arg name: name of the option.  You may also specify
            the literal ``--OPT`` option instead of the "dest" option name.
        :arg default: default value if no option of that name exists.
        :arg skip: if True raise pytest.skip if option does not exists
            or has a None value.
        """
        name = self._opt2dest.get(name, name)
        try:
>           val = getattr(self.option, name)
E           AttributeError: 'Namespace' object has no attribute '--runpytest'

/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1054: AttributeError

During handling of the above exception, another exception occurred:

request = <SubRequest 'mpi_testdir' for <Function test_mpi_file_name>>
tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7f4258d22a60>, _basetemp=PosixPath('/tmp/pytest-of-drew/pytest-3')))

    @pytest.fixture
    def mpi_testdir(request, tmpdir_factory):
>       return MPITestdir(request, tmpdir_factory)

/home/projects/python/build/pytest-mpi/tests/conftest.py:57: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Testdir local('/tmp/pytest-of-drew/pytest-3/test_mpi_file_name0')>, request = <SubRequest 'mpi_testdir' for <Function test_mpi_file_name>>
tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7f4258d22a60>, _basetemp=PosixPath('/tmp/pytest-of-drew/pytest-3')))

    def __init__(self, request, tmpdir_factory):
>       super().__init__(request, tmpdir_factory)
E       ValueError: no option named '--runpytest'

/home/projects/python/build/pytest-mpi/tests/conftest.py:22: ValueError
_____________________________________________________________________________________ ERROR at teardown of test_mpi_file_name _____________________________________________________________________________________

tp = <class 'AttributeError'>, value = None, tb = None

    def reraise(tp, value, tb=None):
        try:
            if value is None:
                value = tp()
            if value.__traceback__ is not tb:
                raise value.with_traceback(tb)
>           raise value

/usr/lib/python3/dist-packages/six.py:703: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3/dist-packages/six.py:703: in reraise
    raise value
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

tp = <class 'AttributeError'>, value = None, tb = None

    def reraise(tp, value, tb=None):
        try:
            if value is None:
                value = tp()
            if value.__traceback__ is not tb:
                raise value.with_traceback(tb)
>           raise value
E           AttributeError: 'MPITestdir' object has no attribute 'monkeypatch'

/usr/lib/python3/dist-packages/six.py:703: AttributeError
________________________________________________________________________________________ ERROR at setup of test_mpi_tmpdir ________________________________________________________________________________________

self = <_pytest.config.Config object at 0x7f426cc55160>, name = '--runpytest', default = <NOTSET>, skip = False

    def getoption(self, name, default=notset, skip=False):
        """ return command line option value.

        :arg name: name of the option.  You may also specify
            the literal ``--OPT`` option instead of the "dest" option name.
        :arg default: default value if no option of that name exists.
        :arg skip: if True raise pytest.skip if option does not exists
            or has a None value.
        """
        name = self._opt2dest.get(name, name)
        try:
>           val = getattr(self.option, name)
E           AttributeError: 'Namespace' object has no attribute '--runpytest'

/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1054: AttributeError

During handling of the above exception, another exception occurred:

request = <SubRequest 'mpi_testdir' for <Function test_mpi_tmpdir>>
tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7f4258d22a60>, _basetemp=PosixPath('/tmp/pytest-of-drew/pytest-3')))

    @pytest.fixture
    def mpi_testdir(request, tmpdir_factory):
>       return MPITestdir(request, tmpdir_factory)

/home/projects/python/build/pytest-mpi/tests/conftest.py:57: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Testdir local('/tmp/pytest-of-drew/pytest-3/test_mpi_tmpdir0')>, request = <SubRequest 'mpi_testdir' for <Function test_mpi_tmpdir>>
tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7f4258d22a60>, _basetemp=PosixPath('/tmp/pytest-of-drew/pytest-3')))

    def __init__(self, request, tmpdir_factory):
>       super().__init__(request, tmpdir_factory)
E       ValueError: no option named '--runpytest'

/home/projects/python/build/pytest-mpi/tests/conftest.py:22: ValueError
______________________________________________________________________________________ ERROR at teardown of test_mpi_tmpdir _______________________________________________________________________________________

tp = <class 'AttributeError'>, value = None, tb = None

    def reraise(tp, value, tb=None):
        try:
            if value is None:
                value = tp()
            if value.__traceback__ is not tb:
                raise value.with_traceback(tb)
>           raise value

/usr/lib/python3/dist-packages/six.py:703: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3/dist-packages/six.py:703: in reraise
    raise value
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

tp = <class 'AttributeError'>, value = None, tb = None

    def reraise(tp, value, tb=None):
        try:
            if value is None:
                value = tp()
            if value.__traceback__ is not tb:
                raise value.with_traceback(tb)
>           raise value
E           AttributeError: 'MPITestdir' object has no attribute 'monkeypatch'

/usr/lib/python3/dist-packages/six.py:703: AttributeError
_______________________________________________________________________________________ ERROR at setup of test_mpi_tmp_path _______________________________________________________________________________________

self = <_pytest.config.Config object at 0x7f426cc55160>, name = '--runpytest', default = <NOTSET>, skip = False

    def getoption(self, name, default=notset, skip=False):
        """ return command line option value.

        :arg name: name of the option.  You may also specify
            the literal ``--OPT`` option instead of the "dest" option name.
        :arg default: default value if no option of that name exists.
        :arg skip: if True raise pytest.skip if option does not exists
            or has a None value.
        """
        name = self._opt2dest.get(name, name)
        try:
>           val = getattr(self.option, name)
E           AttributeError: 'Namespace' object has no attribute '--runpytest'

/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1054: AttributeError

During handling of the above exception, another exception occurred:

request = <SubRequest 'mpi_testdir' for <Function test_mpi_tmp_path>>
tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7f4258d22a60>, _basetemp=PosixPath('/tmp/pytest-of-drew/pytest-3')))

    @pytest.fixture
    def mpi_testdir(request, tmpdir_factory):
>       return MPITestdir(request, tmpdir_factory)

/home/projects/python/build/pytest-mpi/tests/conftest.py:57: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Testdir local('/tmp/pytest-of-drew/pytest-3/test_mpi_tmp_path0')>, request = <SubRequest 'mpi_testdir' for <Function test_mpi_tmp_path>>
tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7f4258d22a60>, _basetemp=PosixPath('/tmp/pytest-of-drew/pytest-3')))

    def __init__(self, request, tmpdir_factory):
>       super().__init__(request, tmpdir_factory)
E       ValueError: no option named '--runpytest'

/home/projects/python/build/pytest-mpi/tests/conftest.py:22: ValueError
_____________________________________________________________________________________ ERROR at teardown of test_mpi_tmp_path ______________________________________________________________________________________

tp = <class 'AttributeError'>, value = None, tb = None

    def reraise(tp, value, tb=None):
        try:
            if value is None:
                value = tp()
            if value.__traceback__ is not tb:
                raise value.with_traceback(tb)
>           raise value

/usr/lib/python3/dist-packages/six.py:703: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3/dist-packages/six.py:703: in reraise
    raise value
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

tp = <class 'AttributeError'>, value = None, tb = None

    def reraise(tp, value, tb=None):
        try:
            if value is None:
                value = tp()
            if value.__traceback__ is not tb:
                raise value.with_traceback(tb)
>           raise value
E           AttributeError: 'MPITestdir' object has no attribute 'monkeypatch'

/usr/lib/python3/dist-packages/six.py:703: AttributeError
___________________________________________________________________________________________ ERROR at setup of test_mpi ____________________________________________________________________________________________
file /home/projects/python/build/pytest-mpi/tests/test_markers.py, line 56
  def test_mpi(testdir):
E       fixture 'testdir' not found
>       available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, doctest_namespace, has_mpi4py, monkeypatch, mpi_file_name, mpi_testdir, mpi_tmp_path, mpi_tmpdir, no_cover, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.

/home/projects/python/build/pytest-mpi/tests/test_markers.py:56
_______________________________________________________________________________________ ERROR at setup of test_mpi_with_mpi _______________________________________________________________________________________

self = <_pytest.config.Config object at 0x7f426cc55160>, name = '--runpytest', default = <NOTSET>, skip = False

    def getoption(self, name, default=notset, skip=False):
        """ return command line option value.

        :arg name: name of the option.  You may also specify
            the literal ``--OPT`` option instead of the "dest" option name.
        :arg default: default value if no option of that name exists.
        :arg skip: if True raise pytest.skip if option does not exists
            or has a None value.
        """
        name = self._opt2dest.get(name, name)
        try:
>           val = getattr(self.option, name)
E           AttributeError: 'Namespace' object has no attribute '--runpytest'

/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1054: AttributeError

During handling of the above exception, another exception occurred:

request = <SubRequest 'mpi_testdir' for <Function test_mpi_with_mpi>>
tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7f4258d22a60>, _basetemp=PosixPath('/tmp/pytest-of-drew/pytest-3')))

    @pytest.fixture
    def mpi_testdir(request, tmpdir_factory):
>       return MPITestdir(request, tmpdir_factory)

/home/projects/python/build/pytest-mpi/tests/conftest.py:57: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Testdir local('/tmp/pytest-of-drew/pytest-3/test_mpi_with_mpi0')>, request = <SubRequest 'mpi_testdir' for <Function test_mpi_with_mpi>>
tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7f4258d22a60>, _basetemp=PosixPath('/tmp/pytest-of-drew/pytest-3')))

    def __init__(self, request, tmpdir_factory):
>       super().__init__(request, tmpdir_factory)
E       ValueError: no option named '--runpytest'

/home/projects/python/build/pytest-mpi/tests/conftest.py:22: ValueError
_____________________________________________________________________________________ ERROR at teardown of test_mpi_with_mpi ______________________________________________________________________________________

tp = <class 'AttributeError'>, value = None, tb = None

    def reraise(tp, value, tb=None):
        try:
            if value is None:
                value = tp()
            if value.__traceback__ is not tb:
                raise value.with_traceback(tb)
>           raise value

/usr/lib/python3/dist-packages/six.py:703: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3/dist-packages/six.py:703: in reraise
    raise value
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

tp = <class 'AttributeError'>, value = None, tb = None

    def reraise(tp, value, tb=None):
        try:
            if value is None:
                value = tp()
            if value.__traceback__ is not tb:
                raise value.with_traceback(tb)
>           raise value
E           AttributeError: 'MPITestdir' object has no attribute 'monkeypatch'

/usr/lib/python3/dist-packages/six.py:703: AttributeError
_______________________________________________________________________________________ ERROR at setup of test_mpi_only_mpi _______________________________________________________________________________________

self = <_pytest.config.Config object at 0x7f426cc55160>, name = '--runpytest', default = <NOTSET>, skip = False

    def getoption(self, name, default=notset, skip=False):
        """ return command line option value.

        :arg name: name of the option.  You may also specify
            the literal ``--OPT`` option instead of the "dest" option name.
        :arg default: default value if no option of that name exists.
        :arg skip: if True raise pytest.skip if option does not exists
            or has a None value.
        """
        name = self._opt2dest.get(name, name)
        try:
>           val = getattr(self.option, name)
E           AttributeError: 'Namespace' object has no attribute '--runpytest'

/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1054: AttributeError

During handling of the above exception, another exception occurred:

request = <SubRequest 'mpi_testdir' for <Function test_mpi_only_mpi>>
tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7f4258d22a60>, _basetemp=PosixPath('/tmp/pytest-of-drew/pytest-3')))

    @pytest.fixture
    def mpi_testdir(request, tmpdir_factory):
>       return MPITestdir(request, tmpdir_factory)

/home/projects/python/build/pytest-mpi/tests/conftest.py:57: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Testdir local('/tmp/pytest-of-drew/pytest-3/test_mpi_only_mpi0')>, request = <SubRequest 'mpi_testdir' for <Function test_mpi_only_mpi>>
tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7f4258d22a60>, _basetemp=PosixPath('/tmp/pytest-of-drew/pytest-3')))

    def __init__(self, request, tmpdir_factory):
>       super().__init__(request, tmpdir_factory)
E       ValueError: no option named '--runpytest'

/home/projects/python/build/pytest-mpi/tests/conftest.py:22: ValueError
_____________________________________________________________________________________ ERROR at teardown of test_mpi_only_mpi ______________________________________________________________________________________

tp = <class 'AttributeError'>, value = None, tb = None

    def reraise(tp, value, tb=None):
        try:
            if value is None:
                value = tp()
            if value.__traceback__ is not tb:
                raise value.with_traceback(tb)
>           raise value

/usr/lib/python3/dist-packages/six.py:703: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3/dist-packages/six.py:703: in reraise
    raise value
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

tp = <class 'AttributeError'>, value = None, tb = None

    def reraise(tp, value, tb=None):
        try:
            if value is None:
                value = tp()
            if value.__traceback__ is not tb:
                raise value.with_traceback(tb)
>           raise value
E           AttributeError: 'MPITestdir' object has no attribute 'monkeypatch'

/usr/lib/python3/dist-packages/six.py:703: AttributeError
_________________________________________________________________________________________ ERROR at setup of test_mpi_skip _________________________________________________________________________________________
file /home/projects/python/build/pytest-mpi/tests/test_markers.py, line 86
  def test_mpi_skip(testdir):
E       fixture 'testdir' not found
>       available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, doctest_namespace, has_mpi4py, monkeypatch, mpi_file_name, mpi_testdir, mpi_tmp_path, mpi_tmpdir, no_cover, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.

/home/projects/python/build/pytest-mpi/tests/test_markers.py:86
____________________________________________________________________________________ ERROR at setup of test_mpi_skip_under_mpi ____________________________________________________________________________________

self = <_pytest.config.Config object at 0x7f426cc55160>, name = '--runpytest', default = <NOTSET>, skip = False

    def getoption(self, name, default=notset, skip=False):
        """ return command line option value.

        :arg name: name of the option.  You may also specify
            the literal ``--OPT`` option instead of the "dest" option name.
        :arg default: default value if no option of that name exists.
        :arg skip: if True raise pytest.skip if option does not exists
            or has a None value.
        """
        name = self._opt2dest.get(name, name)
        try:
>           val = getattr(self.option, name)
E           AttributeError: 'Namespace' object has no attribute '--runpytest'

/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1054: AttributeError

During handling of the above exception, another exception occurred:

request = <SubRequest 'mpi_testdir' for <Function test_mpi_skip_under_mpi>>
tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7f4258d22a60>, _basetemp=PosixPath('/tmp/pytest-of-drew/pytest-3')))

    @pytest.fixture
    def mpi_testdir(request, tmpdir_factory):
>       return MPITestdir(request, tmpdir_factory)

/home/projects/python/build/pytest-mpi/tests/conftest.py:57: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Testdir local('/tmp/pytest-of-drew/pytest-3/test_mpi_skip_under_mpi0')>, request = <SubRequest 'mpi_testdir' for <Function test_mpi_skip_under_mpi>>
tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7f4258d22a60>, _basetemp=PosixPath('/tmp/pytest-of-drew/pytest-3')))

    def __init__(self, request, tmpdir_factory):
>       super().__init__(request, tmpdir_factory)
E       ValueError: no option named '--runpytest'

/home/projects/python/build/pytest-mpi/tests/conftest.py:22: ValueError
__________________________________________________________________________________ ERROR at teardown of test_mpi_skip_under_mpi ___________________________________________________________________________________

tp = <class 'AttributeError'>, value = None, tb = None

    def reraise(tp, value, tb=None):
        try:
            if value is None:
                value = tp()
            if value.__traceback__ is not tb:
                raise value.with_traceback(tb)
>           raise value

/usr/lib/python3/dist-packages/six.py:703: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3/dist-packages/six.py:703: in reraise
    raise value
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

tp = <class 'AttributeError'>, value = None, tb = None

    def reraise(tp, value, tb=None):
        try:
            if value is None:
                value = tp()
            if value.__traceback__ is not tb:
                raise value.with_traceback(tb)
>           raise value
E           AttributeError: 'MPITestdir' object has no attribute 'monkeypatch'

/usr/lib/python3/dist-packages/six.py:703: AttributeError
________________________________________________________________________________________ ERROR at setup of test_mpi_xfail _________________________________________________________________________________________
file /home/projects/python/build/pytest-mpi/tests/test_markers.py, line 102
  def test_mpi_xfail(testdir):
E       fixture 'testdir' not found
>       available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, doctest_namespace, has_mpi4py, monkeypatch, mpi_file_name, mpi_testdir, mpi_tmp_path, mpi_tmpdir, no_cover, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.

/home/projects/python/build/pytest-mpi/tests/test_markers.py:102
___________________________________________________________________________________ ERROR at setup of test_mpi_xfail_under_mpi ____________________________________________________________________________________

self = <_pytest.config.Config object at 0x7f426cc55160>, name = '--runpytest', default = <NOTSET>, skip = False

    def getoption(self, name, default=notset, skip=False):
        """ return command line option value.

        :arg name: name of the option.  You may also specify
            the literal ``--OPT`` option instead of the "dest" option name.
        :arg default: default value if no option of that name exists.
        :arg skip: if True raise pytest.skip if option does not exists
            or has a None value.
        """
        name = self._opt2dest.get(name, name)
        try:
>           val = getattr(self.option, name)
E           AttributeError: 'Namespace' object has no attribute '--runpytest'

/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1054: AttributeError

During handling of the above exception, another exception occurred:

request = <SubRequest 'mpi_testdir' for <Function test_mpi_xfail_under_mpi>>
tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7f4258d22a60>, _basetemp=PosixPath('/tmp/pytest-of-drew/pytest-3')))

    @pytest.fixture
    def mpi_testdir(request, tmpdir_factory):
>       return MPITestdir(request, tmpdir_factory)

/home/projects/python/build/pytest-mpi/tests/conftest.py:57: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Testdir local('/tmp/pytest-of-drew/pytest-3/test_mpi_xfail_under_mpi0')>, request = <SubRequest 'mpi_testdir' for <Function test_mpi_xfail_under_mpi>>
tmpdir_factory = TempdirFactory(_tmppath_factory=TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7f4258d22a60>, _basetemp=PosixPath('/tmp/pytest-of-drew/pytest-3')))

    def __init__(self, request, tmpdir_factory):
>       super().__init__(request, tmpdir_factory)
E       ValueError: no option named '--runpytest'

/home/projects/python/build/pytest-mpi/tests/conftest.py:22: ValueError
__________________________________________________________________________________ ERROR at teardown of test_mpi_xfail_under_mpi __________________________________________________________________________________

tp = <class 'AttributeError'>, value = None, tb = None

    def reraise(tp, value, tb=None):
        try:
            if value is None:
                value = tp()
            if value.__traceback__ is not tb:
                raise value.with_traceback(tb)
>           raise value

/usr/lib/python3/dist-packages/six.py:703: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3/dist-packages/six.py:703: in reraise
    raise value
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

tp = <class 'AttributeError'>, value = None, tb = None

    def reraise(tp, value, tb=None):
        try:
            if value is None:
                value = tp()
            if value.__traceback__ is not tb:
                raise value.with_traceback(tb)
>           raise value
E           AttributeError: 'MPITestdir' object has no attribute 'monkeypatch'

/usr/lib/python3/dist-packages/six.py:703: AttributeError
============================================================================================ 17 error in 0.69 seconds =============================================================================================
aragilar commented 4 years ago

@RizzerOnGitHub how did you install pytest-mpi, having a version mpi-0+unknown suggests you've got something weird going on (the very first commit has mpi-0.1)? Testing this on my desktop (unstable, setting pytest==4.6.9 with tox.ini) has the tests pass fine.

drew-parsons commented 4 years ago

Testing on Debian unstable, with deb package python3-pytest-mpi 0.3+git20191218.a8e7b56-2 installed. The comes from git 20191218 commit a8e7b56. Build logs are available at https://buildd.debian.org/status/package.php?p=pytest-mpi

I guess 0+unknown comes from a NameError in _version.get_versions() when trying to read root = os.path.realpath(__file__) or root = os.path.dirname(root), ll.493-501 in _version.py.

import pytest_mpi
os.path.realpath(pytest_mpi.__file__)

returns '/usr/lib/python3/dist-packages/pytest_mpi/__init__.py'

Setting root to that string,

for i in root.split('/'): 
    root = os.path.dirname(root)

returns root as '/'.

~So~ But the NameError ~must~ oughtn't come from cfg.versionfile_source.split('/').

drew-parsons commented 4 years ago

cfg.versionfile_source is "pytest_mpi/_version.py"

But

for i in "pytest_mpi/_version.py".split('/'): 
     root = os.path.dirname(root) 

returns root as '/usr/lib/python3/dist-packages'

Not clear why get_versions() would be getting a NameError here.

drew-parsons commented 4 years ago

Oh wait, the installed version file differs from the source file:

$ cat /usr/lib/python3/dist-packages/pytest_mpi/_version.py

# This file was generated by 'versioneer.py' (0.18) from
# revision-control system data, or from the parent directory name of an
# unpacked source archive. Distribution tarballs contain a pre-generated copy
# of this file.

import json

version_json = '''
{
 "date": null,
 "dirty": false,
 "error": "no suitable tags",
 "full-revisionid": "a8e7b56301611621004e8551b5bf785bc2810c57",
 "version": "0+unknown"
}
'''  # END VERSION_JSON

def get_versions():
    return json.loads(version_json)

Looks like versioneer.py is overriding the file you've got in source.

Which I gather it's meant to do. The build log has

copying pytest_mpi/_version.py -> /<<PKGBUILDDIR>>/.pybuild/cpython3_3.8_pytest-mpi/build/pytest_mpi
copying pytest_mpi/__init__.py -> /<<PKGBUILDDIR>>/.pybuild/cpython3_3.8_pytest-mpi/build/pytest_mpi
UPDATING /<<PKGBUILDDIR>>/.pybuild/cpython3_3.8_pytest-mpi/build/pytest_mpi/_version.py
set /<<PKGBUILDDIR>>/.pybuild/cpython3_3.8_pytest-mpi/build/pytest_mpi/_version.py to '0+unknown'

with UPDATING and set happening in versioneer.py. Why is versioneer.py applying version='0+unknown' ?

aragilar commented 4 years ago

Yep, versioneer manages _version.py, possibly it due to how you're building it? It's not that important.

Where does autopackagetest run? I realise I didn't use src this time, I probably should've, as I know can conflicts between an installed package and the package in the current dir (though that's usually only if you've got a binary package). I can move to using src, but that doesn't explain why pytest is failing. I presume there's no unusual patches to pytest within Debian?

drew-parsons commented 4 years ago

Do you mean autopkgtest used for the Debian CI tests? The tests are defined in debian/tests but that doesn't exist yet. So debci is only running a nominal superficial test (python3 -c "import pytest_mpi"), it's not yet running pytest-3.

I'm running pytest-3 manually from the top level of the source (I want the tests to pass manually before I set up debian/tests). Once set up this is what autopkgtest would normally be configured to do, run pytest-3 from the source dir [more precisely, it copies the src to a tmpdir and launches from there]. Other, more specific, test configurations or test commands can be used if needed.

Debian source for pytest itself is https://salsa.debian.org/python-team/modules/pytest . There are some patches but no bug reports to indicate they're causing problems.

aragilar commented 4 years ago

Ok, I've dug into what's happening on https://github.com/aragilar/pytest-mpi/blob/master/tests/conftest.py#L44, it seems that for some reason the user site packages are not being picked up correctly (I think somewhere pytest is changing the environment to do that within its testdir setup). Possibly pytest-mpi may be working now with the src dir (at least when I used the system pytest, moving to src seemed to fix that on my system), but running the tests with pytest-mpi in the user site packages seems to be still failing.

aragilar commented 4 years ago

Also, would you prefer me tagging v0.4 now, and try to fix this later, or hold off tagging v0.4 until this is fixed?

aragilar commented 4 years ago

The other thing is to ensure that -p pytester is included in the pytest cli, as pytester (pytest test logic) isn't included otherwise.

drew-parsons commented 4 years ago

Probably best to hold off 0.4 until this is fixed I figure, if pytest-3 is supposed to work (without specifying -p pytester) from the src dir. Unless it's going to time some time to fix, in which case follow your preferred schedule.

drew-parsons commented 4 years ago

In any case, you've just given the practical workaround I need for autopkgtest. pytest-3 -p pytester works just fine for me, I can use that in debian/tests. I didn't realise -p pytester was the key.

drew-parsons commented 4 years ago

So possibly this isn't actually a bug, if -p pytester should always be given explicitly. That could be fair enough, "who tests the tester?".

drew-parsons commented 4 years ago

But do put in the documentation somewhere that -p pytester is needed when invoking pytest!