Hello community,
here is the log from the commit of package python-pytest-attrib for
openSUSE:Factory checked in at 2019-02-14 14:34:35
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pytest-attrib (Old)
and /work/SRC/openSUSE:Factory/.python-pytest-attrib.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-attrib"
Thu Feb 14 14:34:35 2019 rev:3 rq:674595 version:0.1.3
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-pytest-attrib/python-pytest-attrib.changes
2018-05-04 11:29:59.534682036 +0200
+++
/work/SRC/openSUSE:Factory/.python-pytest-attrib.new.28833/python-pytest-attrib.changes
2019-02-14 14:34:39.183617325 +0100
@@ -1,0 +2,5 @@
+Wed Feb 13 14:35:32 UTC 2019 - Tomáš Chvátal <[email protected]>
+
+- Switch to github tarball in order to run test
+
+-------------------------------------------------------------------
Old:
----
pytest-attrib-0.1.3.tar.gz
New:
----
0.1.3.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-pytest-attrib.spec ++++++
--- /var/tmp/diff_new_pack.YIq5kN/_old 2019-02-14 14:34:40.127616897 +0100
+++ /var/tmp/diff_new_pack.YIq5kN/_new 2019-02-14 14:34:40.127616897 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-pytest-attrib
#
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,7 +12,7 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
@@ -24,8 +24,7 @@
License: MIT
Group: Development/Languages/Python
Url: http://pypi.python.org/pypi/pytest-attrib/
-Source:
https://files.pythonhosted.org/packages/source/p/pytest-attrib/pytest-attrib-%{version}.tar.gz
-BuildRequires: %{python_module devel}
+Source:
https://github.com/AbdealiJK/pytest-attrib/archive/%{version}.tar.gz
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
@@ -51,6 +50,7 @@
%prep
%setup -q -n pytest-attrib-%{version}
+rm setup.cfg
%build
%python_build
@@ -60,7 +60,7 @@
%python_expand %fdupes %{buildroot}%{python_sitelib}
%check
-%python_exec setup.py test
+%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib}
py.test-%{$python_bin_suffix} -v
%files %{python_files}
%doc README.rst
++++++ pytest-attrib-0.1.3.tar.gz -> 0.1.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-attrib-0.1.3/.gitignore
new/pytest-attrib-0.1.3/.gitignore
--- old/pytest-attrib-0.1.3/.gitignore 1970-01-01 01:00:00.000000000 +0100
+++ new/pytest-attrib-0.1.3/.gitignore 2016-05-24 13:20:43.000000000 +0200
@@ -0,0 +1,75 @@
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+/env/
+/build/
+/develop-eggs/
+/dist/
+/downloads/
+/eggs/
+/.eggs/
+/lib/
+/lib64/
+/parts/
+/sdist/
+/var/
+*.egg-info/
+.installed.cfg
+*.egg
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*,cover
+.hypothesis/
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
+
+#Ipython Notebook
+.ipynb_checkpoints
+
+# rultor
+.ci/rultor_secrets.sh
+
+# coala
+*.orig
+
+# Pyenv
+.python-version
+
+# Virtualenv
+/env
+/venv
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-attrib-0.1.3/.travis.yml
new/pytest-attrib-0.1.3/.travis.yml
--- old/pytest-attrib-0.1.3/.travis.yml 1970-01-01 01:00:00.000000000 +0100
+++ new/pytest-attrib-0.1.3/.travis.yml 2016-05-24 13:20:43.000000000 +0200
@@ -0,0 +1,28 @@
+language: python
+
+sudo: false
+
+python:
+ - '2.6'
+ - '2.7'
+ - '3.3'
+ - '3.4'
+ - '3.5'
+
+os:
+ - linux
+
+install:
+ - pip install -r requirements.txt
+ - pip install -e .
+
+script:
+ - py.test
+ - flake8
+ # Ensure latest pytest-attrib in pypi works
+ - pip uninstall pytest-attrib -y
+ - python setup.py sdist
+ - pip install --no-deps --no-cache-dir --force-reinstall --no-index
--find-links dist pytest-attrib
+
+notifications:
+ email: false
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-attrib-0.1.3/PKG-INFO
new/pytest-attrib-0.1.3/PKG-INFO
--- old/pytest-attrib-0.1.3/PKG-INFO 2016-05-24 13:22:52.000000000 +0200
+++ new/pytest-attrib-0.1.3/PKG-INFO 1970-01-01 01:00:00.000000000 +0100
@@ -1,104 +0,0 @@
-Metadata-Version: 1.1
-Name: pytest-attrib
-Version: 0.1.3
-Summary: pytest plugin to select tests based on attributes similar to the
nose-attrib plugin
-Home-page: http://pypi.python.org/pypi/pytest-attrib/
-Author: Abdeali JK
-Author-email: [email protected]
-License: MIT License
-Description: .. image::
https://travis-ci.org/AbdealiJK/pytest-attrib.svg?branch=master
- :target: https://travis-ci.org/AbdealiJK/pytest-attrib
-
- .. image::
https://ci.appveyor.com/api/projects/status/1q5qdliai6hu4hrv/branch/master?svg=true
- :target: https://ci.appveyor.com/project/AbdealiJK/pytest-attrib
-
- pytest-attrib
- =============
-
- The `pytest-attrib`_ plugin extends py.test with the ability to select
tests
- based on a criteria rather than just the filename or pytest.marks. For
- example, you might want to run only tests that need internet
connectivity,
- or tests that are slow.
-
- The `pytest.mark <https://pytest.org/latest/mark.html>`__ plugin
already
- provides a featrure to mark tests and run only the marked tests. This
plugin
- also allows to run expressions on the attributes of the class, and
does not
- require the pytest.mark decorator.
-
- It offers features similar to the nose plugin
- `nose-attrib
<http://nose.readthedocs.io/en/latest/plugins/attrib.html>`__.
-
- Installation
- ------------
-
- Install the plugin with::
-
- pip install pytest-attrib
-
- Usage examples
- --------------
-
- To use the plugin, the ``-a`` CLI argument has been provided. Consider
a
- project with the test file::
-
- import unittest
-
- class MyTestCase(unittest.TestCase):
- def test_function(self):
- assert 1 == 1
-
- class MySlowTestCase(unittest.TestCase):
- slow = True
-
- def test_slow_function(self):
- import time
- time.sleep(5)
- assert 1 == 1
-
- Using pytest-attrib, only the slow tests can be run using::
-
- $ py.test -a slow
-
- Or run only the fast tests using::
-
- $ py.test -a "not slow"
-
- The expression given in the ``-a`` argument can be even more complex,
for
- example::
-
- $ py.test -a "slow and requires_internet"
- $ py.test -a "slow and not requires_internet"
-
- It can also do conditional arguments like::
-
- $ py.test -a "speed=='slow' and requires_internet"
-
- LICENSE
- -------
-
- .. image::
https://img.shields.io/github/license/AbdealiJK/pytest-attrib.svg
- :target: https://opensource.org/licenses/MIT
-
- This code falls under the
- `MIT License <https://tldrlegal.com/license/mit-license>`__.
- Please note that some files or content may be copied from other places
- and have their own licenses. Dependencies that are being used to
generate
- the databases also have their own licenses.
-
-Platform: UNKNOWN
-Classifier: Development Status :: 4 - Beta
-Classifier: Environment :: Plugins
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Operating System :: POSIX
-Classifier: Operating System :: Microsoft :: Windows
-Classifier: Operating System :: MacOS :: MacOS X
-Classifier: Topic :: Software Development :: Testing
-Classifier: Topic :: Software Development :: Libraries
-Classifier: Topic :: Utilities
-Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2.6
-Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3.2
-Classifier: Programming Language :: Python :: 3.3
-Classifier: Programming Language :: Python :: 3.4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-attrib-0.1.3/appveyor.yml
new/pytest-attrib-0.1.3/appveyor.yml
--- old/pytest-attrib-0.1.3/appveyor.yml 1970-01-01 01:00:00.000000000
+0100
+++ new/pytest-attrib-0.1.3/appveyor.yml 2016-05-24 13:20:43.000000000
+0200
@@ -0,0 +1,54 @@
+environment:
+
+ global:
+ APPVEYOR_PYTHON_URL:
"https://raw.githubusercontent.com/ogrisel/python-appveyor-demo/master/appveyor/"
+
+ # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
+ # /E:ON and /V:ON options are not enabled in the batch script intepreter
+ # See: http://stackoverflow.com/a/13751649/163740
+ CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd"
+
+ matrix:
+ - PYTHON: "C:\\Python27"
+ PYTHON_VERSION: "2.7.x" # currently 2.7.9
+ PYTHON_ARCH: "32"
+
+ - PYTHON: "C:\\Python34"
+ PYTHON_VERSION: "3.4.x" # currently 3.4.3
+ PYTHON_ARCH: "32"
+
+ - PYTHON: "C:\\Python27-x64"
+ PYTHON_VERSION: "2.7.x" # currently 2.7.9
+ PYTHON_ARCH: "64"
+
+ - PYTHON: "C:\\Python34-x64"
+ PYTHON_VERSION: "3.4.x" # currently 3.4.3
+ PYTHON_ARCH: "64"
+
+init:
+ - "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%"
+ - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
+
+install:
+ # Download the Appveyor Python build accessories into subdirectory .\appveyor
+ - mkdir appveyor
+ - ps: $wc = new-object net.webclient
+ - ps: $run = $wc.DownloadString($env:APPVEYOR_PYTHON_URL +
'run_with_env.cmd')
+ - ps: $run | Out-File -Encoding ascii -FilePath appveyor\run_with_env.cmd
+
+ # This is needed for Python versions not installed on Appveyor build machines
+ - ps: if (-not(Test-Path($env:PYTHON))) { iex
$wc.DownloadString($env:APPVEYOR_PYTHON_URL + 'install.ps1') }
+ - pip install virtualenv
+ - virtualenv env
+ - env\Scripts\activate.bat
+ - pip install -r requirements.txt
+
+build: off
+
+test_script:
+ - "%CMD_IN_ENV% pip install -e ."
+ - "%CMD_IN_ENV% python -m pytest"
+ # Ensure latest pytest-attrib in pypi works
+ - pip uninstall pytest-attrib -y
+ - python setup.py sdist
+ - pip install --no-deps --no-cache-dir --force-reinstall --no-index
--find-links dist pytest-attrib
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-attrib-0.1.3/conftest.py
new/pytest-attrib-0.1.3/conftest.py
--- old/pytest-attrib-0.1.3/conftest.py 1970-01-01 01:00:00.000000000 +0100
+++ new/pytest-attrib-0.1.3/conftest.py 2016-05-24 13:20:43.000000000 +0200
@@ -0,0 +1,12 @@
+import pytest
+
+
+pytest_plugins = "pytester"
+
+
[email protected]
+def testdir(testdir):
+ # pytest before 2.8 did not have a runpytest_subprocess
+ if not hasattr(testdir, "runpytest_subprocess"):
+ testdir.runpytest_subprocess = testdir.runpytest
+ return testdir
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-attrib-0.1.3/pytest_attrib.egg-info/PKG-INFO
new/pytest-attrib-0.1.3/pytest_attrib.egg-info/PKG-INFO
--- old/pytest-attrib-0.1.3/pytest_attrib.egg-info/PKG-INFO 2016-05-24
13:22:51.000000000 +0200
+++ new/pytest-attrib-0.1.3/pytest_attrib.egg-info/PKG-INFO 1970-01-01
01:00:00.000000000 +0100
@@ -1,104 +0,0 @@
-Metadata-Version: 1.1
-Name: pytest-attrib
-Version: 0.1.3
-Summary: pytest plugin to select tests based on attributes similar to the
nose-attrib plugin
-Home-page: http://pypi.python.org/pypi/pytest-attrib/
-Author: Abdeali JK
-Author-email: [email protected]
-License: MIT License
-Description: .. image::
https://travis-ci.org/AbdealiJK/pytest-attrib.svg?branch=master
- :target: https://travis-ci.org/AbdealiJK/pytest-attrib
-
- .. image::
https://ci.appveyor.com/api/projects/status/1q5qdliai6hu4hrv/branch/master?svg=true
- :target: https://ci.appveyor.com/project/AbdealiJK/pytest-attrib
-
- pytest-attrib
- =============
-
- The `pytest-attrib`_ plugin extends py.test with the ability to select
tests
- based on a criteria rather than just the filename or pytest.marks. For
- example, you might want to run only tests that need internet
connectivity,
- or tests that are slow.
-
- The `pytest.mark <https://pytest.org/latest/mark.html>`__ plugin
already
- provides a featrure to mark tests and run only the marked tests. This
plugin
- also allows to run expressions on the attributes of the class, and
does not
- require the pytest.mark decorator.
-
- It offers features similar to the nose plugin
- `nose-attrib
<http://nose.readthedocs.io/en/latest/plugins/attrib.html>`__.
-
- Installation
- ------------
-
- Install the plugin with::
-
- pip install pytest-attrib
-
- Usage examples
- --------------
-
- To use the plugin, the ``-a`` CLI argument has been provided. Consider
a
- project with the test file::
-
- import unittest
-
- class MyTestCase(unittest.TestCase):
- def test_function(self):
- assert 1 == 1
-
- class MySlowTestCase(unittest.TestCase):
- slow = True
-
- def test_slow_function(self):
- import time
- time.sleep(5)
- assert 1 == 1
-
- Using pytest-attrib, only the slow tests can be run using::
-
- $ py.test -a slow
-
- Or run only the fast tests using::
-
- $ py.test -a "not slow"
-
- The expression given in the ``-a`` argument can be even more complex,
for
- example::
-
- $ py.test -a "slow and requires_internet"
- $ py.test -a "slow and not requires_internet"
-
- It can also do conditional arguments like::
-
- $ py.test -a "speed=='slow' and requires_internet"
-
- LICENSE
- -------
-
- .. image::
https://img.shields.io/github/license/AbdealiJK/pytest-attrib.svg
- :target: https://opensource.org/licenses/MIT
-
- This code falls under the
- `MIT License <https://tldrlegal.com/license/mit-license>`__.
- Please note that some files or content may be copied from other places
- and have their own licenses. Dependencies that are being used to
generate
- the databases also have their own licenses.
-
-Platform: UNKNOWN
-Classifier: Development Status :: 4 - Beta
-Classifier: Environment :: Plugins
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Operating System :: POSIX
-Classifier: Operating System :: Microsoft :: Windows
-Classifier: Operating System :: MacOS :: MacOS X
-Classifier: Topic :: Software Development :: Testing
-Classifier: Topic :: Software Development :: Libraries
-Classifier: Topic :: Utilities
-Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2.6
-Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3.2
-Classifier: Programming Language :: Python :: 3.3
-Classifier: Programming Language :: Python :: 3.4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-attrib-0.1.3/pytest_attrib.egg-info/SOURCES.txt
new/pytest-attrib-0.1.3/pytest_attrib.egg-info/SOURCES.txt
--- old/pytest-attrib-0.1.3/pytest_attrib.egg-info/SOURCES.txt 2016-05-24
13:22:52.000000000 +0200
+++ new/pytest-attrib-0.1.3/pytest_attrib.egg-info/SOURCES.txt 1970-01-01
01:00:00.000000000 +0100
@@ -1,14 +0,0 @@
-LICENSE
-MANIFEST.in
-README.rst
-setup.cfg
-setup.py
-pytest_attrib/VERSION
-pytest_attrib/__init__.py
-pytest_attrib/plugin.py
-pytest_attrib.egg-info/PKG-INFO
-pytest_attrib.egg-info/SOURCES.txt
-pytest_attrib.egg-info/dependency_links.txt
-pytest_attrib.egg-info/entry_points.txt
-pytest_attrib.egg-info/requires.txt
-pytest_attrib.egg-info/top_level.txt
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-attrib-0.1.3/pytest_attrib.egg-info/dependency_links.txt
new/pytest-attrib-0.1.3/pytest_attrib.egg-info/dependency_links.txt
--- old/pytest-attrib-0.1.3/pytest_attrib.egg-info/dependency_links.txt
2016-05-24 13:22:51.000000000 +0200
+++ new/pytest-attrib-0.1.3/pytest_attrib.egg-info/dependency_links.txt
1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-attrib-0.1.3/pytest_attrib.egg-info/entry_points.txt
new/pytest-attrib-0.1.3/pytest_attrib.egg-info/entry_points.txt
--- old/pytest-attrib-0.1.3/pytest_attrib.egg-info/entry_points.txt
2016-05-24 13:22:51.000000000 +0200
+++ new/pytest-attrib-0.1.3/pytest_attrib.egg-info/entry_points.txt
1970-01-01 01:00:00.000000000 +0100
@@ -1,3 +0,0 @@
-[pytest11]
-attrib = pytest_attrib.plugin
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-attrib-0.1.3/pytest_attrib.egg-info/requires.txt
new/pytest-attrib-0.1.3/pytest_attrib.egg-info/requires.txt
--- old/pytest-attrib-0.1.3/pytest_attrib.egg-info/requires.txt 2016-05-24
13:22:51.000000000 +0200
+++ new/pytest-attrib-0.1.3/pytest_attrib.egg-info/requires.txt 1970-01-01
01:00:00.000000000 +0100
@@ -1 +0,0 @@
-pytest>=2.2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-attrib-0.1.3/pytest_attrib.egg-info/top_level.txt
new/pytest-attrib-0.1.3/pytest_attrib.egg-info/top_level.txt
--- old/pytest-attrib-0.1.3/pytest_attrib.egg-info/top_level.txt
2016-05-24 13:22:51.000000000 +0200
+++ new/pytest-attrib-0.1.3/pytest_attrib.egg-info/top_level.txt
1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-pytest_attrib
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-attrib-0.1.3/requirements.txt
new/pytest-attrib-0.1.3/requirements.txt
--- old/pytest-attrib-0.1.3/requirements.txt 1970-01-01 01:00:00.000000000
+0100
+++ new/pytest-attrib-0.1.3/requirements.txt 2016-05-24 13:20:43.000000000
+0200
@@ -0,0 +1,12 @@
+pytest>=2.8.0
+pytest-cov
+pytest-env
+pytest-timeout
+flake8
+pyflakes
+flake8-string-format
+pep8-naming
+pep257
+autopep8
+
+unittest2 ; python_full_version < '2.7.3'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-attrib-0.1.3/setup.cfg
new/pytest-attrib-0.1.3/setup.cfg
--- old/pytest-attrib-0.1.3/setup.cfg 2016-05-24 13:22:52.000000000 +0200
+++ new/pytest-attrib-0.1.3/setup.cfg 2016-05-24 13:20:43.000000000 +0200
@@ -1,16 +1,17 @@
[pytest]
timeout = 5
-testpaths =
- pytest_attrib
- tests
-addopts =
- --color=yes
- --doctest-glob=*.rst
- --doctest-modules
- --doctest-ignore-import-error
- -r s
-env =
- PYTHONHASHSEED=0
+testpaths =
+ pytest_attrib
+ tests
+addopts =
+ --color=yes
+ --doctest-glob=*.rst
+ --doctest-modules
+ --doctest-ignore-import-error
+ -r s
+env =
+ PYTHONHASHSEED=0
+# PYTHONHASHSEED=0 is required to use same hashes in pytests-xdist's workers
[coverage:run]
branch = True
@@ -21,10 +22,5 @@
show_missing = True
[flake8]
-ignore = D
-
-[egg_info]
-tag_build =
-tag_date = 0
-tag_svn_revision = 0
-
+# D = Documentation issues
+ignore=D
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-attrib-0.1.3/tests/test_attrib.py
new/pytest-attrib-0.1.3/tests/test_attrib.py
--- old/pytest-attrib-0.1.3/tests/test_attrib.py 1970-01-01
01:00:00.000000000 +0100
+++ new/pytest-attrib-0.1.3/tests/test_attrib.py 2016-05-24
13:20:43.000000000 +0200
@@ -0,0 +1,184 @@
+import pytest
+
+
+def check_passed(spec, testdir, with_parent=False):
+ opt = spec[0]
+ expected_results = spec[1:] # passed, skipped, failed
+
+ rec = testdir.inline_run("-a", opt)
+ actual_results = rec.listoutcomes()
+ actual_results = actual_results[:len(expected_results)]
+
+ for expected, actual in zip(expected_results, actual_results):
+ if with_parent:
+ actual = ["::".join(x.nodeid.split("::")[-2:]) for x in actual]
+ else:
+ actual = [x.nodeid.split("::")[-1] for x in actual]
+ assert len(actual) == len(expected)
+ assert set(actual) == set(expected)
+
+
+def test_arg(testdir):
+ result = testdir.runpytest("--help")
+ result.stdout.fnmatch_lines("*-a ATTREXPR*")
+
+
+def test_config(testdir):
+ config = testdir.parseconfig()
+ assert config.getoption('attrexpr') == ''
+
+ config = testdir.parseconfig('-a', 'attr1')
+ assert config.getoption('attrexpr') == 'attr1'
+
+ config = testdir.parseconfig('-a', 'attr1==val1 and attr2==True')
+ assert config.getoption('attrexpr') == 'attr1==val1 and attr2==True'
+
+ config = testdir.parseconfig('-a', 'attr1==val1 and attr2==True',
+ '-k', 'somethingelse')
+ assert config.getoption('attrexpr') == 'attr1==val1 and attr2==True'
+
+
[email protected]("spec", [
+ ("xyz", ("test_one",)),
+ ("xyz and xyz2", ()),
+ ("xyz2", ("test_two",)),
+ ("xyz or xyz2", ("test_one", "test_two"),)
+])
+def test_functions(spec, testdir):
+ testdir.makepyfile("""
+ def test_one(): pass
+ test_one.xyz = "xyz"
+
+ def test_two(): pass
+ test_two.xyz2 = "xyz2"
+ """)
+ return check_passed(spec, testdir)
+
+
[email protected]("spec", [
+ ("xyz", (), ("test_one",)),
+ ("xyz2", ("test_two",)),
+ ("1", ("test_two",), ("test_one",)), # Test without -a
+])
+def test_functions_decorated(spec, testdir):
+ testdir.makepyfile("""
+ import sys
+ if sys.version_info < (2, 7, 3):
+ import unittest2 as unittest
+ else:
+ import unittest
+
+ @unittest.skipIf(1 == 1, 'From test_one')
+ def test_one(): pass
+ test_one.xyz = "xyz"
+
+ @unittest.skipIf(1 == 0, 'From test_two')
+ def test_two(): pass
+ test_two.xyz2 = "xyz2"
+ """)
+ return check_passed(spec, testdir)
+
+
[email protected]("spec", [
+ ("xyz", ("test_two", "test_four",), ("test_one", "test_three",)),
+])
+def test_functions_badly_decorated(spec, testdir):
+ testdir.makepyfile("""
+ import functools
+ import sys
+ if sys.version_info < (2, 7, 3):
+ import unittest2 as unittest
+ else:
+ import unittest
+
+ def allowed_failure(func):
+ def wrapper(*args, **kwargs):
+ try: func(*args, **kwargs)
+ except AssertionError:
+ raise unittest.SkipTest('Failing is ok')
+ wrapper.__name__ == func.__name__
+ return wrapper
+
+ class MyTest(unittest.TestCase):
+ @allowed_failure
+ def test_one(self):
+ raise AssertionError('Failing in test_one')
+ xyz = "xyz"
+
+ @allowed_failure
+ def test_two(self): pass
+ xyz = "xyz"
+
+ @allowed_failure
+ def test_three():
+ raise AssertionError('Failing in test_three')
+ test_three.xyz = "xyz"
+
+ @allowed_failure
+ def test_four(): pass
+ test_four.xyz = "xyz"
+ """)
+ return check_passed(spec, testdir)
+
+
[email protected]("spec", [
+ ("xyz", ("OneTest::test_one",)),
+ ("xyz2", ("TwoTest::test_two",)),
+ ("xyz3", ("ThreeTest::test_three",)),
+ ("xyz2 or xyz3", ("TwoTest::test_two", "ThreeTest::test_three")),
+])
+def test_classes(spec, testdir):
+ testdir.makepyfile("""
+ import unittest
+ class OneTest(unittest.TestCase):
+ def test_one(self): pass
+ OneTest.xyz = "xyz"
+
+ class TwoTest(unittest.TestCase):
+ def test_two(self): pass
+ xyz2 = "xyz2"
+
+ class ThreeTest(unittest.TestCase):
+ def test_three(self): pass
+ test_three.xyz3 = "xyz3"
+ """)
+ return check_passed(spec, testdir, with_parent=True)
+
+
[email protected]("spec", [
+ ("xyz", ("OneTest::test_one", "TwoTest::test_one", "TwoTest::test_two")),
+ ("xyz2", ("TwoTest::test_one", "TwoTest::test_two",)),
+])
+def test_classes_inherited(spec, testdir):
+ testdir.makepyfile("""
+ import unittest
+ class OneTest(unittest.TestCase):
+ def test_one(self): pass
+ OneTest.xyz = "xyz"
+
+ class TwoTest(OneTest):
+ def test_two(self): pass
+ xyz2 = "xyz2"
+ """)
+ return check_passed(spec, testdir, with_parent=True)
+
+
[email protected]("spec", [
+ ("xyz=='xyz'", ("test_one",)),
+ ("xyz=='xyz2'", ()),
+ ("xyz=='xyz2' or xyz2", ("test_two",)),
+ ("xyz=='xyz2' and xyz2=='xyz'", ()),
+ ("xyz=='xyz' and xyz2=='xyz2'", ()),
+])
+def test_conditionals(spec, testdir):
+ testdir.makepyfile("""
+ import unittest
+ class OneTest(unittest.TestCase):
+ def test_one(self): pass
+ xyz = "xyz"
+
+ class TwoTest(unittest.TestCase):
+ def test_two(self): pass
+ xyz2 = "xyz2"
+ """)
+ return check_passed(spec, testdir)