A grab-bag of nifty pytest plugins

Overview

A goody-bag of nifty plugins for pytest

OS Build Coverage
Linux CircleCI (Linux) Coverage Status
Windows Travic CI (Windows)
Plugin Description Supported OS
pytest-server-fixtures Extensible server-running framework with a suite of well-known databases and webservices included Linux
pytest-shutil Unix shell and environment management tools Linux
pytest-profiling Profiling plugin with tabular heat graph output and gprof support for C-Extensions Linux
pytest-devpi-server DevPI server fixture Linux
pytest-pyramid-server Pyramid server fixture Linux
pytest-webdriver Selenium webdriver fixture Linux
pytest-virtualenv Virtualenv fixture Linux Windows
pytest-qt-app PyQT application fixture Linux
pytest-listener TCP Listener/Reciever for testing remote systems Linux Windows
pytest-git Git repository fixture Linux Windows
pytest-svn SVN repository fixture Linux
pytest-fixture-config Configuration tools for Py.test fixtures Linux Windows
pytest-verbose-parametrize Makes py.test's parametrize output a little more verbose Linux

Developing these plugins

All of these plugins share setup code and configuration so there is a top-level Makefile to automate process of setting them up for test and development.

Pre-requisites

You have python installed on your path, preferably using a virtualenv

Makefile targets

To install all dependencies and set up all of the packages for development simply run:

    make develop

To install all the packages as wheel distributions:

    make install

To run all the tests:

    make test

To setup test environment in Vagrant (requires virtualbox):

    $ vagrant up
    $ vagrant ssh

    # ..... inside vagrant ....
    . venv/bin/activate
    make develop
    make test

foreach.sh

To run a command in each of the package directories, use the foreach.sh script. This example will build all the wheel distributions:

    ./foreach.sh python setup.py bdist_wheel
Comments
  • Fixed SVG file generation on windows (#93)

    Fixed SVG file generation on windows (#93)

    This pull request fixes #93.

    It basically replaces the use of pipes.Template, that does not work on windows, with use of subprocess.Popen. An alternate code, using a temporary file, that is probably even more portable, is also included and commented out - just in case this version does not work on ALL targets (I expect it to work on both POSIX-compliant and WIN though).

    The final terminal prints are also improved so as to display a correct error message in case of failure.

    opened by smarie 15
  • Rethink fixture breaks on python3

    Rethink fixture breaks on python3

      File "/Users/daenyth/project/lib/python3.5/site-packages/pytest_server_fixtures/rethink.py", line 94
        except rethinkdb.errors.RqlRuntimeError, err:
                                               ^
    SyntaxError: invalid syntax
    
    opened by Daenyth 10
  • python3 can't find pytest_shutils' Workspace?

    python3 can't find pytest_shutils' Workspace?

    We're using pytest_shutils Workspace for integration testing but our build fails Travis CI on python 3.5 where it passes with Python 2.7. The error is that python 3 can't find cmdline and can't import Workspace. Is python3.5 incompatibility with pytest_shutils a currently known issue?

    python3_pytest_shutil_error

    opened by go-bears 10
  • Latest pytest-shutil broken on OSX

    Latest pytest-shutil broken on OSX

    I get this error - seems to be related to pytest-shutil

    Command "/Users/daenyth/Curata/observer/.tox/unit/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/88/f3twmqg95t95_03rxspf2ptr0000gn/T/pip-build-g9gqwg4u/pytest-shutil/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/88/f3twmqg95t95_03rxspf2ptr0000gn/T/pip-_fl5ht7f-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/daenyth/Curata/observer/.tox/unit/bin/../include/site/python3.6/pytest-shutil" failed with error code 1 in /private/var/folders/88/f3twmqg95t95_03rxspf2ptr0000gn/T/pip-build-g9gqwg4u/pytest-shutil/
    
    pip freeze
    aiopg==0.13.0
    amazon-kclpy==1.4.5
    apipkg==1.4
    APScheduler==3.3.1
    boto==2.48.0
    boto3==1.4.4
    botocore==1.5.86
    contextlib2==0.5.5
    coverage==4.4.1
    docutils==0.13.1
    execnet==1.4.1
    hypothesis==3.1.0
    jmespath==0.9.3
    mock==2.0.0
    path.py==10.3.1
    pbr==3.1.1
    protobuf==3.3.0
    psycopg2==2.7.3
    py==1.4.34
    pyhocon==0.3.35
    pyparsing==2.2.0
    pytest==3.1.3
    pytest-asyncio==0.6.0
    pytest-cov==2.5.1
    python-dateutil==2.6.1
    pytz==2017.2
    raven==6.1.0
    redis==2.10.5
    s3transfer==0.1.10
    six==1.10.0
    SQLAlchemy==1.1.11
    tzlocal==1.4
    
    Full stack trace from pip install
    pip install pytest-server-fixtures
    Collecting pytest-server-fixtures
      Using cached pytest-server-fixtures-1.2.11.tar.gz
    Requirement already satisfied: pytest in ./.tox/unit/lib/python3.6/site-packages (from pytest-server-fixtures)
    Collecting pytest-shutil (from pytest-server-fixtures)
      Using cached pytest-shutil-1.2.11.tar.gz
    Collecting pytest-fixture-config (from pytest-server-fixtures)
      Using cached pytest-fixture-config-1.2.11.tar.gz
    Requirement already satisfied: six in ./.tox/unit/lib/python3.6/site-packages (from pytest-server-fixtures)
    Collecting requests (from pytest-server-fixtures)
      Using cached requests-2.18.1-py2.py3-none-any.whl
    Requirement already satisfied: setuptools in ./.tox/unit/lib/python3.6/site-packages (from pytest->pytest-server-fixtures)
    Requirement already satisfied: py>=1.4.33 in ./.tox/unit/lib/python3.6/site-packages (from pytest->pytest-server-fixtures)
    Requirement already satisfied: execnet in ./.tox/unit/lib/python3.6/site-packages (from pytest-shutil->pytest-server-fixtures)
    Requirement already satisfied: contextlib2 in ./.tox/unit/lib/python3.6/site-packages (from pytest-shutil->pytest-server-fixtures)
    Requirement already satisfied: path.py in ./.tox/unit/lib/python3.6/site-packages (from pytest-shutil->pytest-server-fixtures)
    Requirement already satisfied: mock in ./.tox/unit/lib/python3.6/site-packages (from pytest-shutil->pytest-server-fixtures)
    Collecting certifi>=2017.4.17 (from requests->pytest-server-fixtures)
      Using cached certifi-2017.4.17-py2.py3-none-any.whl
    Collecting chardet<3.1.0,>=3.0.2 (from requests->pytest-server-fixtures)
      Using cached chardet-3.0.4-py2.py3-none-any.whl
    Collecting idna<2.6,>=2.5 (from requests->pytest-server-fixtures)
      Using cached idna-2.5-py2.py3-none-any.whl
    Collecting urllib3<1.22,>=1.21.1 (from requests->pytest-server-fixtures)
      Using cached urllib3-1.21.1-py2.py3-none-any.whl
    Requirement already satisfied: apipkg>=1.4 in ./.tox/unit/lib/python3.6/site-packages (from execnet->pytest-shutil->pytest-server-fixtures)
    Requirement already satisfied: pbr>=0.11 in ./.tox/unit/lib/python3.6/site-packages (from mock->pytest-shutil->pytest-server-fixtures)
    Building wheels for collected packages: pytest-server-fixtures, pytest-shutil, pytest-fixture-config
      Building wheel for pytest-server-fixtures failed: [Errno 13] Permission denied: '/Users/daenyth/Library/Caches/pip/wheels/d5/8e'
      Running setup.py bdist_wheel for pytest-shutil ... error
      Complete output from command /Users/daenyth/Curata/observer/.tox/unit/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/88/f3twmqg95t95_03rxspf2ptr0000gn/T/pip-build-g9gqwg4u/pytest-shutil/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /var/folders/88/f3twmqg95t95_03rxspf2ptr0000gn/T/tmpd95io9zhpip-wheel- --python-tag cp36:
      Traceback (most recent call last):
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/dist.py", line 488, in fetch_build_egg
          cmd = self._egg_fetcher
      AttributeError: 'Distribution' object has no attribute '_egg_fetcher'
    
      During handling of the above exception, another exception occurred:
    
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "/private/var/folders/88/f3twmqg95t95_03rxspf2ptr0000gn/T/pip-build-g9gqwg4u/pytest-shutil/setup.py", line 53, in <module>
          setup(**kwargs)
        File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 108, in setup
          _setup_distribution = dist = klass(attrs)
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/dist.py", line 325, in __init__
          self.fetch_build_eggs(attrs['setup_requires'])
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/dist.py", line 444, in fetch_build_eggs
          replace_conflicting=True,
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/pkg_resources/__init__.py", line 854, in resolve
          dist = best[req.key] = env.best_match(req, ws, installer)
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1126, in best_match
          return self.obtain(req, installer)
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1138, in obtain
          return installer(requirement)
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/dist.py", line 514, in fetch_build_egg
          cmd.ensure_finalized()
        File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/cmd.py", line 107, in ensure_finalized
          self.finalize_options()
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 333, in finalize_options
          self.index_url, search_path=self.shadow_path, hosts=hosts,
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/package_index.py", line 306, in __init__
          and (ca_bundle or ssl_support.find_ca_bundle())
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/ssl_support.py", line 247, in find_ca_bundle
          or _certifi_where()
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/ssl_support.py", line 253, in _certifi_where
          return __import__('certifi').where()
      AttributeError: module 'certifi' has no attribute 'where'
    
      ----------------------------------------
      Failed building wheel for pytest-shutil
      Running setup.py clean for pytest-shutil
      Complete output from command /Users/daenyth/Curata/observer/.tox/unit/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/88/f3twmqg95t95_03rxspf2ptr0000gn/T/pip-build-g9gqwg4u/pytest-shutil/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" clean --all:
      Traceback (most recent call last):
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/dist.py", line 488, in fetch_build_egg
          cmd = self._egg_fetcher
      AttributeError: 'Distribution' object has no attribute '_egg_fetcher'
    
      During handling of the above exception, another exception occurred:
    
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "/private/var/folders/88/f3twmqg95t95_03rxspf2ptr0000gn/T/pip-build-g9gqwg4u/pytest-shutil/setup.py", line 53, in <module>
          setup(**kwargs)
        File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 108, in setup
          _setup_distribution = dist = klass(attrs)
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/dist.py", line 325, in __init__
          self.fetch_build_eggs(attrs['setup_requires'])
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/dist.py", line 444, in fetch_build_eggs
          replace_conflicting=True,
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/pkg_resources/__init__.py", line 854, in resolve
          dist = best[req.key] = env.best_match(req, ws, installer)
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1126, in best_match
          return self.obtain(req, installer)
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1138, in obtain
          return installer(requirement)
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/dist.py", line 514, in fetch_build_egg
          cmd.ensure_finalized()
        File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/cmd.py", line 107, in ensure_finalized
          self.finalize_options()
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 333, in finalize_options
          self.index_url, search_path=self.shadow_path, hosts=hosts,
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/package_index.py", line 306, in __init__
          and (ca_bundle or ssl_support.find_ca_bundle())
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/ssl_support.py", line 247, in find_ca_bundle
          or _certifi_where()
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/ssl_support.py", line 253, in _certifi_where
          return __import__('certifi').where()
      AttributeError: module 'certifi' has no attribute 'where'
    
      ----------------------------------------
      Failed cleaning build dir for pytest-shutil
      Running setup.py bdist_wheel for pytest-fixture-config ... error
      Complete output from command /Users/daenyth/Curata/observer/.tox/unit/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/88/f3twmqg95t95_03rxspf2ptr0000gn/T/pip-build-g9gqwg4u/pytest-fixture-config/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /var/folders/88/f3twmqg95t95_03rxspf2ptr0000gn/T/tmphnw4i2eepip-wheel- --python-tag cp36:
      Traceback (most recent call last):
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/dist.py", line 488, in fetch_build_egg
          cmd = self._egg_fetcher
      AttributeError: 'Distribution' object has no attribute '_egg_fetcher'
    
      During handling of the above exception, another exception occurred:
    
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "/private/var/folders/88/f3twmqg95t95_03rxspf2ptr0000gn/T/pip-build-g9gqwg4u/pytest-fixture-config/setup.py", line 40, in <module>
          setup(**kwargs)
        File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 108, in setup
          _setup_distribution = dist = klass(attrs)
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/dist.py", line 325, in __init__
          self.fetch_build_eggs(attrs['setup_requires'])
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/dist.py", line 444, in fetch_build_eggs
          replace_conflicting=True,
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/pkg_resources/__init__.py", line 854, in resolve
          dist = best[req.key] = env.best_match(req, ws, installer)
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1126, in best_match
          return self.obtain(req, installer)
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1138, in obtain
          return installer(requirement)
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/dist.py", line 514, in fetch_build_egg
          cmd.ensure_finalized()
        File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/cmd.py", line 107, in ensure_finalized
          self.finalize_options()
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 333, in finalize_options
          self.index_url, search_path=self.shadow_path, hosts=hosts,
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/package_index.py", line 306, in __init__
          and (ca_bundle or ssl_support.find_ca_bundle())
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/ssl_support.py", line 247, in find_ca_bundle
          or _certifi_where()
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/ssl_support.py", line 253, in _certifi_where
          return __import__('certifi').where()
      AttributeError: module 'certifi' has no attribute 'where'
    
      ----------------------------------------
      Failed building wheel for pytest-fixture-config
      Running setup.py clean for pytest-fixture-config
      Complete output from command /Users/daenyth/Curata/observer/.tox/unit/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/88/f3twmqg95t95_03rxspf2ptr0000gn/T/pip-build-g9gqwg4u/pytest-fixture-config/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" clean --all:
      Traceback (most recent call last):
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/dist.py", line 488, in fetch_build_egg
          cmd = self._egg_fetcher
      AttributeError: 'Distribution' object has no attribute '_egg_fetcher'
    
      During handling of the above exception, another exception occurred:
    
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "/private/var/folders/88/f3twmqg95t95_03rxspf2ptr0000gn/T/pip-build-g9gqwg4u/pytest-fixture-config/setup.py", line 40, in <module>
          setup(**kwargs)
        File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 108, in setup
          _setup_distribution = dist = klass(attrs)
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/dist.py", line 325, in __init__
          self.fetch_build_eggs(attrs['setup_requires'])
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/dist.py", line 444, in fetch_build_eggs
          replace_conflicting=True,
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/pkg_resources/__init__.py", line 854, in resolve
          dist = best[req.key] = env.best_match(req, ws, installer)
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1126, in best_match
          return self.obtain(req, installer)
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1138, in obtain
          return installer(requirement)
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/dist.py", line 514, in fetch_build_egg
          cmd.ensure_finalized()
        File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/cmd.py", line 107, in ensure_finalized
          self.finalize_options()
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 333, in finalize_options
          self.index_url, search_path=self.shadow_path, hosts=hosts,
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/package_index.py", line 306, in __init__
          and (ca_bundle or ssl_support.find_ca_bundle())
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/ssl_support.py", line 247, in find_ca_bundle
          or _certifi_where()
        File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/ssl_support.py", line 253, in _certifi_where
          return __import__('certifi').where()
      AttributeError: module 'certifi' has no attribute 'where'
    
      ----------------------------------------
      Failed cleaning build dir for pytest-fixture-config
    Failed to build pytest-server-fixtures pytest-shutil pytest-fixture-config
    Installing collected packages: pytest-shutil, pytest-fixture-config, certifi, chardet, idna, urllib3, requests, pytest-server-fixtures
      Running setup.py install for pytest-shutil ... error
        Complete output from command /Users/daenyth/Curata/observer/.tox/unit/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/88/f3twmqg95t95_03rxspf2ptr0000gn/T/pip-build-g9gqwg4u/pytest-shutil/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/88/f3twmqg95t95_03rxspf2ptr0000gn/T/pip-_fl5ht7f-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/daenyth/Curata/observer/.tox/unit/bin/../include/site/python3.6/pytest-shutil:
        Traceback (most recent call last):
          File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/dist.py", line 488, in fetch_build_egg
            cmd = self._egg_fetcher
        AttributeError: 'Distribution' object has no attribute '_egg_fetcher'
    
        During handling of the above exception, another exception occurred:
    
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File "/private/var/folders/88/f3twmqg95t95_03rxspf2ptr0000gn/T/pip-build-g9gqwg4u/pytest-shutil/setup.py", line 53, in <module>
            setup(**kwargs)
          File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 108, in setup
            _setup_distribution = dist = klass(attrs)
          File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/dist.py", line 325, in __init__
            self.fetch_build_eggs(attrs['setup_requires'])
          File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/dist.py", line 444, in fetch_build_eggs
            replace_conflicting=True,
          File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/pkg_resources/__init__.py", line 854, in resolve
            dist = best[req.key] = env.best_match(req, ws, installer)
          File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1126, in best_match
            return self.obtain(req, installer)
          File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1138, in obtain
            return installer(requirement)
          File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/dist.py", line 514, in fetch_build_egg
            cmd.ensure_finalized()
          File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/cmd.py", line 107, in ensure_finalized
            self.finalize_options()
          File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 333, in finalize_options
            self.index_url, search_path=self.shadow_path, hosts=hosts,
          File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/package_index.py", line 306, in __init__
            and (ca_bundle or ssl_support.find_ca_bundle())
          File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/ssl_support.py", line 247, in find_ca_bundle
            or _certifi_where()
          File "/Users/daenyth/Curata/observer/.tox/unit/lib/python3.6/site-packages/setuptools/ssl_support.py", line 253, in _certifi_where
            return __import__('certifi').where()
        AttributeError: module 'certifi' has no attribute 'where'
    
        ----------------------------------------
    Command "/Users/daenyth/Curata/observer/.tox/unit/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/88/f3twmqg95t95_03rxspf2ptr0000gn/T/pip-build-g9gqwg4u/pytest-shutil/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/88/f3twmqg95t95_03rxspf2ptr0000gn/T/pip-_fl5ht7f-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/daenyth/Curata/observer/.tox/unit/bin/../include/site/python3.6/pytest-shutil" failed with error code 1 in /private/var/folders/88/f3twmqg95t95_03rxspf2ptr0000gn/T/pip-build-g9gqwg4u/pytest-shutil/
    (unit) alpha!observer * $>
    
    
    opened by Daenyth 8
  • Hanging indefinitely on `s.bind` in base.py

    Hanging indefinitely on `s.bind` in base.py

    Using 1.2.5, when I run my tests, the library hangs indefinitely on s.bind. I rolled back to 1.2.4 and it works. I'm fairly sure what's happening is that binding to a random IP doesn't work on OSX. https://github.com/manahl/pytest-plugins/blob/master/pytest-server-fixtures/pytest_server_fixtures/base.py#L43

    opened by Daenyth 8
  • Error from pytest-profiling when doing a 'chdir' in a test

    Error from pytest-profiling when doing a 'chdir' in a test

    Pytest-profiling (version 1.2.2) is working well on my 2 machines (Windows and Mac OSX).

    However, when a test contains a os.chdir, the following error is raised:

    
    self = <pytest_profiling.Profiling object at 0x10c744910>, item = <Function 'test_chdir[dir1]'>
    
        @pytest.hookimpl(hookwrapper=True)
        def pytest_runtest_call(self, item):
            prof = cProfile.Profile()
            prof.enable()
            yield
            prof.disable()
            prof_filename = os.path.join("prof", clean_filename(item.name) + ".prof")
            try:
    >           prof.dump_stats(prof_filename)
    
    /Library/Python/2.7/site-packages/pytest_profiling.py:68: 
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    
    self = <cProfile.Profile object at 0x10c780c20>, file = 'prof/test_chdir[dir1].prof'
    
        def dump_stats(self, file):
            import marshal
    >       f = open(file, 'wb')
    E       IOError: [Errno 2] No such file or directory: u'prof/test_chdir[dir1].prof'
    
    /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/cProfile.py:85: IOError
    

    The code I used to reproduce the issue is the following

    
    import pytest
    import os
    from time import sleep
    
    @pytest.mark.parametrize("dir", [
    	"dir1", "dir2", "NewFolder"
    ])
    def test_chdir(dir):
    	try: os.mkdir(dir)
    	except: pass
    	
    	sleep(0.3)
    
    	try:
    		os.chdir(dir)
    	except Exception as e:
    		assert False, "Error while going to directory '{}': {}".format(dir, e)
    
    
    
    opened by jfthuong 7
  • pstats data not created and setup.py fails to install

    pstats data not created and setup.py fails to install

    Thanks open sourcing the plugin. However, however I tried, I could not make it run as intended.

    Broken setup.py

    I could not install the plugin by running "setup.py sdist install". That is, the installation did not fail, but running py.test --profile failed with ImportError: No module named pytest_profiling. Indeed pytest_profiling.py was nowhere to be found in my virtualenv dir.

    This happens, I believe, since setuptools' find_packages looks for packages (dir with __init__.py module), and the pytest_profiling.py module should probably be specified in a py_modules argument to setup.py:

    py_modules=['pytest_profiling'],
    

    To get over this I either fix setup.py or manually copy pytest_profiling.py module to my virtualenv site-packages dir.


    More trouble

    Now that the plugin runs, I see the "prof/" dir is created; however, nothing appears in it.

    $ PYTHONPATH=. py.test /Users/pavel/project/tests/test_report.py --profile-svg -vv
    =============================================== test session starts ================================================
    platform darwin -- Python 2.7.10 -- py-1.4.30 -- pytest-2.7.2 -- /Users/pavel/.venvs/project/bin/python
    rootdir: /Users/pavel/project/src, inifile:
    plugins: profiling
    collected 7 items
    
    tests/test_report.py::TestReport::test_ignored PASSED
    tests/test_report.py::TestReport::test_disabled <- /Users/pavel/project/tests/__init__.py PASSED
    
    ============================================= 7 passed in 1.50 seconds =============================================
    
    $ ls -la1 prof/
    .
    ..
    

    This happens when I run py.test with both --profile-svg and --profile arguments.

    opened by asfaltboy 7
  • pytest profiling-svg doesn't work on python 2.7

    pytest profiling-svg doesn't work on python 2.7

    pytest --profiling work perfectly on python2.7 but the option --profiling-svg doesn't work. The profiling report is generated but the svg isn't . The error trace is : test/test_standalone.py ..sh: 2: dot: not found Traceback (most recent call last): File "/home/aurelien/virtual_env/hotcountenv/bin/gprof2dot", line 11, in <module> sys.exit(main()) File "/home/aurelien/virtual_env/hotcountenv/lib/python2.7/site-packages/gprof2dot.py", line 3319, in main dot.graph(profile, theme) File "/home/aurelien/virtual_env/hotcountenv/lib/python2.7/site-packages/gprof2dot.py", line 3065, in graph arrowsize = "%.2f" % theme.edge_arrowsize(weight), File "/home/aurelien/virtual_env/hotcountenv/lib/python2.7/site-packages/gprof2dot.py", line 3093, in edge self.attr_list(attrs) File "/home/aurelien/virtual_env/hotcountenv/lib/python2.7/site-packages/gprof2dot.py", line 3110, in attr_list self.id(value) File "/home/aurelien/virtual_env/hotcountenv/lib/python2.7/site-packages/gprof2dot.py", line 3123, in id self.write(s) File "/home/aurelien/virtual_env/hotcountenv/lib/python2.7/site-packages/gprof2dot.py", line 3147, in write self.fp.write(s) IOError: [Errno 32] Broken pipe

    opened by aurelBZH 6
  • pytest-profiling  does not profile fixtures

    pytest-profiling does not profile fixtures

    Consider the following example:

    import pytest
    
    
    @pytest.fixture()
    def work_func_fix():
        s = 0
        for i in range(1000):
            s += i * i
        return s
    
    
    def work_func_test():
        s = 0
        for i in range(1000):
            s += i * i
        return s
    
    
    def test_example(work_func_fix):
        assert work_func_fix == work_func_test()
    

    Apparently, only test_example is profiled. work_func_test appears in the profiling results, but work_func_fix does not.

    Is it a design choice? I've been searching but found no reference to that. Or is there a flag I should pass to enable fixture profiling?

    We use pytest to test a Flask application. Fixtures create the database, and instantiate and initialize the application. We'd like to profile the initialization process but it does not appear in the results.

    In fact, the profiling result in my example above shows a lot of things I don't care about (everything that is not under test_example), but not the fixture I do care about.

    opened by lafrech 6
  • add PYTEST_DONT_REWRITE in order to suppress module already imported

    add PYTEST_DONT_REWRITE in order to suppress module already imported

    After calling pytest.main twice, pytest creates this warning summary

    ===================================================================== warnings summary =====================================================================
    ~/lib/python2.7/site-packages/_pytest/assertion/rewrite.py:272
    ~/lib/python2.7/site-packages/_pytest/assertion/rewrite.py:272: PytestWarning: Module already imported so cannot be rewritten: pytest_profiling
        self.config,
    ...
    

    According to

    • https://github.com/pytest-dev/pytest/issues/2995
    • https://github.com/pytest-dev/pytest-cov/pull/228/commits/22387a604ce8a082cc6381f1bbc28fa434c97bbe

    the doc string PYTEST_DONT_REWRITE can be used to suppress this warning.

    enhancement 
    opened by jonathansp 5
  • Plugins incompatible with pytest 4, leads to ContextualVersionConflict

    Plugins incompatible with pytest 4, leads to ContextualVersionConflict

    As can be seen in this commit, none of the plugins are compatible with pytest. This causes test suites that depend on them to fail. Consider:

    setuptools master $ pip-run -q pytest pytest-virtualenv -- -c "import pkg_resources; pkg_resources.require('pytest-virtualenv')"                                                         
    pytest-shutil 1.4.0 has requirement pytest<4.0.0, but you'll have pytest 4.1.1 which is incompatible.
    pytest-fixture-config 1.4.0 has requirement pytest<4.0.0, but you'll have pytest 4.1.1 which is incompatible.
    pytest-virtualenv 1.4.0 has requirement pytest<4.0.0, but you'll have pytest 4.1.1 which is incompatible.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/Users/jaraco/code/main/setuptools/pkg_resources/__init__.py", line 898, in require
        needed = self.resolve(parse_requirements(requirements))
      File "/Users/jaraco/code/main/setuptools/pkg_resources/__init__.py", line 789, in resolve
        raise VersionConflict(dist, req).with_context(dependent_req)
    pkg_resources.ContextualVersionConflict: (pytest 4.1.1 (/private/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-svi02ctd), Requirement.parse('pytest<4.0.0'), {'pytest-shutil', 'pytest-fixture-config', 'pytest-virtualenv'})
    
    enhancement help wanted 
    opened by jaraco 5
  • shutil: tests/unit/test_cmdline.py::test_pretty_formatter fails with termcolor >= 2.1.0

    shutil: tests/unit/test_cmdline.py::test_pretty_formatter fails with termcolor >= 2.1.0

    Reproduced on 1.7.0 and 5f9b88a65a8c1e506885352bbd9b2a47900f5014, using Python 3.11.1. The test passes with termcolor < 2.1 but fails with 2.1.0 and 2.1.1.

    ________________________________________________________ test_pretty_formatter ________________________________________________________
    
        def test_pretty_formatter():
            f = cmdline.PrettyFormatter()
            f.title('A Title')
            f.hr()
            f.p('A Paragraph', 'red')
    >       assert f.buffer == [
                '\x1b[1m\x1b[34m  A Title\x1b[0m',
                '\x1b[1m\x1b[34m--------------------------------------------------------------------------------\x1b[0m',
                '\x1b[31mA Paragraph\x1b[0m'
                ]
    E       AssertionError: assert ['  A Title', '--------------------------------------------------------------------------------', 'A Paragraph'] == ['\x1b[1m\x1b[34m  A Title\x1b[0m', '\x1b[1m\x1b[34m--------------------------------------------------------------------------------\x1b[0m', '\x1b[31mA Paragraph\x1b[0m']
    E         At index 0 diff: '  A Title' != '\x1b[1m\x1b[34m  A Title\x1b[0m'
    E         Full diff:
    E           [
    E         -  '\x1b[1m\x1b[34m  A Title\x1b[0m',
    E         +  '  A Title',
    E         -  '\x1b[1m\x1b[34m--------------------------------------------------------------------------------\x1b[0m',
    E         ?   ---------------                                                                                -------
    E         +  '--------------------------------------------------------------------------------',
    E         -  '\x1b[31mA Paragraph\x1b[0m',
    E         +  'A Paragraph',
    E           ]
    
    /tmp/pytest-plugins/pytest-shutil/tests/unit/test_cmdline.py:18: AssertionError
    
    opened by mgorny 0
  • Use `pypandoc.convert_text` instead of `pypandoc.convert`

    Use `pypandoc.convert_text` instead of `pypandoc.convert`

    Currently, pypandoc does not have convert function. https://github.com/NicklasTegner/pypandoc/blob/master/pypandoc/init.py pypandoc only has convert_file or convert_text.

    Actually pypandoc previously have convert function like https://github.com/NicklasTegner/pypandoc/blob/c06d7b64a58729fa174b7721dac6c600fad166af/pypandoc/init.py

    Related issue https://github.com/man-group/pytest-plugins/issues/87

    opened by shmpwk 0
  • fix: if SELENIUM_URI is set then Remote Webdriver should be used

    fix: if SELENIUM_URI is set then Remote Webdriver should be used

    fix the ambiguity: documentation says:

    [SELENIUM_URI] is needed when dealing with selenium server and not chrome driver (see https://groups.google.com/forum/?fromgroups#!topic/selenium-users/xodZDJxt81o). If SELENIUM_URI is not defined SELENIUM_HOST & SELENIUM_PORT will be used.

    this sounds like when you set SELENIUM_URI, a Remote Webdriver is used. this is currently not the case and this PR fixes it.

    opened by vladosaurus 0
  • Incompatible with Python 3.10

    Incompatible with Python 3.10

    Python 3.10 finally really eliminated all those classes in collections package which were long time ago moved to collections.abc. So, from collections import Iterable truly ceased to work.

    This patch:

    ---
     pytest_verbose_parametrize.py |    5 ++++-
     1 file changed, 4 insertions(+), 1 deletion(-)
    
    --- a/pytest_verbose_parametrize.py
    +++ b/pytest_verbose_parametrize.py
    @@ -1,4 +1,7 @@
    -from collections import Iterable
    +try:
    +    from collections.abc import Iterable
    +except (ImportError, ModuleNotFoundError):
    +    from collections import Iterable
     from six import string_types, text_type
    

    fixes the problem.

    bug 
    opened by mcepl 4
Owner
Man Group
Man Group
Playwright Python tool practice pytest pytest-bdd screen-play page-object allure cucumber-report

pytest-ui-automatic Playwright Python tool practice pytest pytest-bdd screen-play page-object allure cucumber-report How to run Run tests execute_test

moyu6027 11 Nov 8, 2022
pytest plugin providing a function to check if pytest is running.

pytest-is-running pytest plugin providing a function to check if pytest is running. Installation Install with: python -m pip install pytest-is-running

Adam Johnson 21 Nov 1, 2022
Pytest-typechecker - Pytest plugin to test how type checkers respond to code

pytest-typechecker this is a plugin for pytest that allows you to create tests t

vivax 2 Aug 20, 2022
Pytest-rich - Pytest + rich integration (proof of concept)

pytest-rich Leverage rich for richer test session output. This plugin is not pub

Bruno Oliveira 170 Dec 2, 2022
A pytest plugin to run an ansible collection's unit tests with pytest.

pytest-ansible-units An experimental pytest plugin to run an ansible collection's unit tests with pytest. Description pytest-ansible-units is a pytest

Community managed Ansible repositories 9 Dec 9, 2022
A Django plugin for pytest.

Welcome to pytest-django! pytest-django allows you to test your Django project/applications with the pytest testing tool. Quick start / tutorial Chang

pytest-dev 1.1k Dec 31, 2022
A set of pytest fixtures to test Flask applications

pytest-flask An extension of pytest test runner which provides a set of useful tools to simplify testing and development of the Flask extensions and a

pytest-dev 433 Dec 23, 2022
A command-line tool and Python library and Pytest plugin for automated testing of RESTful APIs, with a simple, concise and flexible YAML-based syntax

1.0 Release See here for details about breaking changes with the upcoming 1.0 release: https://github.com/taverntesting/tavern/issues/495 Easier API t

null 909 Dec 15, 2022
pytest splinter and selenium integration for anyone interested in browser interaction in tests

Splinter plugin for the pytest runner Install pytest-splinter pip install pytest-splinter Features The plugin provides a set of fixtures to use splin

pytest-dev 238 Nov 14, 2022
The pytest framework makes it easy to write small tests, yet scales to support complex functional testing

The pytest framework makes it easy to write small tests, yet scales to support complex functional testing for applications and libraries. An example o

pytest-dev 9.6k Jan 2, 2023
Coverage plugin for pytest.

Overview docs tests package This plugin produces coverage reports. Compared to just using coverage run this plugin does some extras: Subprocess suppor

pytest-dev 1.4k Dec 29, 2022
Thin-wrapper around the mock package for easier use with pytest

pytest-mock This plugin provides a mocker fixture which is a thin-wrapper around the patching API provided by the mock package: import os class UnixF

pytest-dev 1.5k Jan 5, 2023
pytest plugin for distributed testing and loop-on-failures testing modes.

xdist: pytest distributed testing plugin The pytest-xdist plugin extends pytest with some unique test execution modes: test run parallelization: if yo

pytest-dev 1.1k Dec 30, 2022
Plugin for generating HTML reports for pytest results

pytest-html pytest-html is a plugin for pytest that generates a HTML report for test results. Resources Documentation Release Notes Issue Tracker Code

pytest-dev 548 Dec 28, 2022
Pytest support for asyncio.

pytest-asyncio: pytest support for asyncio pytest-asyncio is an Apache2 licensed library, written in Python, for testing asyncio code with pytest. asy

pytest-dev 1.1k Jan 2, 2023
Mypy static type checker plugin for Pytest

pytest-mypy Mypy static type checker plugin for pytest Features Runs the mypy static type checker on your source files as part of your pytest test run

Dan Bader 218 Jan 3, 2023
:game_die: Pytest plugin to randomly order tests and control random.seed

pytest-randomly Pytest plugin to randomly order tests and control random.seed. Features All of these features are on by default but can be disabled wi

pytest-dev 471 Dec 30, 2022
A rewrite of Python's builtin doctest module (with pytest plugin integration) but without all the weirdness

The xdoctest package is a re-write of Python's builtin doctest module. It replaces the old regex-based parser with a new abstract-syntax-tree based pa

Jon Crall 174 Dec 16, 2022
Selects tests affected by changed files. Continous test runner when used with pytest-watch.

This is a pytest plug-in which automatically selects and re-executes only tests affected by recent changes. How is this possible in dynamic language l

Tibor Arpas 614 Dec 30, 2022