Hello community,
here is the log from the commit of package python-pytest-services for
openSUSE:Factory checked in at 2019-11-18 20:06:14
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pytest-services (Old)
and /work/SRC/openSUSE:Factory/.python-pytest-services.new.26869 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-services"
Mon Nov 18 20:06:14 2019 rev:2 rq:748853 version:2.0.1
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-pytest-services/python-pytest-services.changes
2019-03-19 09:57:51.100115992 +0100
+++
/work/SRC/openSUSE:Factory/.python-pytest-services.new.26869/python-pytest-services.changes
2019-11-18 20:06:16.821716748 +0100
@@ -1,0 +2,11 @@
+Fri Nov 15 10:37:18 UTC 2019 - Tomáš Chvátal <[email protected]>
+
+- Update to 2.0.1:
+ * #23: Rely on zc.lockfile for lockfile behavior.
+ * #28: Fixtures now supports later versions of mysql and no longer support
versions of mysql prior to mysql --initialize support.
+ * #29: Fix issues with later versions of mysql where mysql_defaults_file
fixture would prevent startup of mysql.
+ * Fixed issue in test suite where mysql fixture was not tested.
+ * Removed pytest_services.locks.lock_file.
+ * #20: Added workaround for issue with SysLogHandler.
+
+-------------------------------------------------------------------
Old:
----
1.3.1.tar.gz
New:
----
2.0.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-pytest-services.spec ++++++
--- /var/tmp/diff_new_pack.gXtgZj/_old 2019-11-18 20:06:17.837716238 +0100
+++ /var/tmp/diff_new_pack.gXtgZj/_new 2019-11-18 20:06:17.845716235 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-pytest-services
#
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LLC.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,20 +18,20 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-pytest-services
-Version: 1.3.1
+Version: 2.0.1
Release: 0
Summary: Services plugin for pytest testing framework
License: MIT
-Group: Development/Languages/Python
URL: https://github.com/pytest-dev/pytest-services
Source:
https://github.com/pytest-dev/pytest-services/archive/%{version}.tar.gz
BuildRequires: %{python_module mock}
+BuildRequires: %{python_module mysqlclient}
BuildRequires: %{python_module psutil}
+BuildRequires: %{python_module pylibmc}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module requests}
BuildRequires: %{python_module setuptools}
-BuildRequires: %{python_module pylibmc}
-BuildRequires: %{python_module mysqlclient}
+BuildRequires: %{python_module zc.lockfile >= 2.0}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: python-subprocess32
@@ -39,6 +39,7 @@
Requires: python-pytest
Requires: python-requests
Requires: python-setuptools
+Requires: python-zc.lockfile >= 2.0
Recommends: python-pylibmc
BuildArch: noarch
%ifpython2
@@ -62,7 +63,7 @@
%check
# test_memcached test_mysql test_xvfb - need running X/mysql/memcache servers
-%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib}
py.test-%{$python_bin_suffix} -v -k 'not (test_memcached or test_mysql or
test_xvfb)'
+%pytest -k 'not (test_memcached or test_mysql or test_xvfb)'
%files %{python_files}
%doc CHANGES.rst README.rst
++++++ 1.3.1.tar.gz -> 2.0.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-services-1.3.1/.travis.yml
new/pytest-services-2.0.1/.travis.yml
--- old/pytest-services-1.3.1/.travis.yml 2018-10-24 14:07:03.000000000
+0200
+++ new/pytest-services-2.0.1/.travis.yml 2019-11-12 22:04:01.000000000
+0100
@@ -1,20 +1,28 @@
sudo: false
language: python
-python: "3.4"
-env:
- matrix:
- - TESTENV=linters
- - TESTENV=py27
- - TESTENV=py27-xdist
- - TESTENV=py27-pytest-latest
- - TESTENV=py34
- - TESTENV=coveralls
-install:
- - pip install tox
-script: tox -e $TESTENV
+python: "2.7"
+
+matrix:
+ include:
+ - env: TOXENV=linters
+ - env: TOXENV=py27-pytest39
+ - env: TOXENV=py27-pytest310
+ - env: TOXENV=py27-pytestlatest
+ - env: TOXENV=py27-pytestlatest-xdist
+ - env: TOXENV=py34-pytestlatest
+ python: "3.4"
+ - env: TOXENV=py35-pytestlatest
+ python: "3.5"
+ - env: TOXENV=py36-pytestlatest
+ python: "3.6"
+ - env: TOXENV=py27-pytestlatest-coveralls
+install: pip install tox
+# mysql_install_db will not work if it can't find the my-default.cnf file
+before_script: sudo cp /etc/mysql/my.cnf /usr/share/mysql/my-default.cnf
+script: tox
branches:
except:
- - /^\d/
+ - /^\d/
notifications:
email:
- [email protected]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-services-1.3.1/CHANGES.rst
new/pytest-services-2.0.1/CHANGES.rst
--- old/pytest-services-1.3.1/CHANGES.rst 2018-10-24 14:07:03.000000000
+0200
+++ new/pytest-services-2.0.1/CHANGES.rst 2019-11-12 22:04:01.000000000
+0100
@@ -1,6 +1,22 @@
Changelog
=========
+2.0.1
+-----
+
+- #20: Added workaround for issue with SysLogHandler.
+
+2.0.0
+-----
+
+- #23: Rely on ``zc.lockfile`` for lockfile behavior.
+- #28: Fixtures now supports later versions of mysql and no longer
+ support versions of mysql prior to ``mysql --initialize`` support.
+- #29: Fix issues with later versions of mysql where ``mysql_defaults_file``
+ fixture would prevent startup of mysql.
+- Fixed issue in test suite where mysql fixture was not tested.
+- Removed ``pytest_services.locks.lock_file``.
+
1.3.1
-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-services-1.3.1/README.rst
new/pytest-services-2.0.1/README.rst
--- old/pytest-services-1.3.1/README.rst 2018-10-24 14:07:03.000000000
+0200
+++ new/pytest-services-2.0.1/README.rst 2019-11-12 22:04:01.000000000
+0100
@@ -41,7 +41,7 @@
--------
* run_services
- Determines whethere services should be run or not. False by default if not
in distributed environment
+ Determines whether services should be run or not. False by default if not
in distributed environment
(without pytest-xdist_). Can be manually set to True by overriding this
fixture in your test config or
just by using `--run-services` command line argument (see below).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-services-1.3.1/pytest_services/__init__.py
new/pytest-services-2.0.1/pytest_services/__init__.py
--- old/pytest-services-1.3.1/pytest_services/__init__.py 2018-10-24
14:07:03.000000000 +0200
+++ new/pytest-services-2.0.1/pytest_services/__init__.py 2019-11-12
22:04:01.000000000 +0100
@@ -1,2 +1,2 @@
"""pytest-services package."""
-__version__ = '1.3.1'
+__version__ = '2.0.1'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-services-1.3.1/pytest_services/locks.py
new/pytest-services-2.0.1/pytest_services/locks.py
--- old/pytest-services-1.3.1/pytest_services/locks.py 2018-10-24
14:07:03.000000000 +0200
+++ new/pytest-services-2.0.1/pytest_services/locks.py 2019-11-12
22:04:01.000000000 +0100
@@ -1,78 +1,33 @@
"""Fixtures for supporting a distributed test run."""
import contextlib
-import errno
-import fcntl
import json
import os
import socket
-import time
import pytest
+import zc.lockfile
marker = object()
-def lock_file(filename, content, operation):
- """Lock given file.
-
- :param filename: full path to the lockfile
- :param content: content string to write to the lockfile after successful
lock
- :param operation: os operation to use for lock
- :return: file object of opened locked file. Can be used to write content
to it
- """
- try:
- handle = os.fdopen(os.open(filename, os.O_RDWR | os.O_CREAT, 0o666),
'r+')
- except OSError as e:
- if e.errno == errno.EACCES:
- raise Exception('Failed to open/create file. Check permissions on
containing folder')
- raise
- fcntl.flock(handle, operation)
- if content:
- handle.write(content)
- handle.flush()
- os.fsync(handle.fileno())
+def try_remove(filename):
try:
- os.chmod(filename, 0o666)
+ os.unlink(filename)
except OSError:
pass
- return handle
-
-
-def unlock_file(filename, handle, remove=True):
- """Unlock given file."""
- fcntl.flock(handle, fcntl.LOCK_UN)
- handle.close()
- if remove:
- try:
- os.unlink(filename)
- except OSError:
- pass
@contextlib.contextmanager
-def file_lock(filename, operation=fcntl.LOCK_EX, remove=True, timeout=20):
+def file_lock(filename, remove=True, timeout=20):
"""A lock that is shared across processes.
:param filename: the name of the file that will be locked.
- :pram operation: the lock operation.
"""
- # http://bservices_log.vmfarms.com/2011/03/cross-process-locking-and.html
- times = 0
- while True:
- try:
- handle = lock_file(filename, None, operation)
- break
- except IOError:
- if times > timeout:
- raise Exception('Not able to aquire lock file {0} in
{1}'.format(filename, timeout))
- time.sleep(0.5)
- times += 1
+ with contextlib.closing(zc.lockfile.SimpleLockFile(filename)) as lockfile:
+ yield lockfile._fp
- try:
- yield handle
- finally:
- unlock_file(filename, handle, remove=remove)
+ remove and try_remove(filename)
def unlock_resource(name, resource, lock_dir, services_log):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-services-1.3.1/pytest_services/log.py
new/pytest-services-2.0.1/pytest_services/log.py
--- old/pytest-services-1.3.1/pytest_services/log.py 2018-10-24
14:07:03.000000000 +0200
+++ new/pytest-services-2.0.1/pytest_services/log.py 2019-11-12
22:04:01.000000000 +0100
@@ -20,12 +20,21 @@
pass
logger = logging.getLogger('[{slave_id}] {name}'.format(name=__name__,
slave_id=slave_id))
logger.setLevel(logging.DEBUG)
- if handler:
+ if handler and workaround_issue_20(handler):
logger.propagate = 0
logger.addHandler(handler)
return logger
+def workaround_issue_20(handler):
+ """
+ Workaround for
+ https://github.com/pytest-dev/pytest-services/issues/20,
+ disabling installation of a broken handler.
+ """
+ return hasattr(handler, 'socket')
+
+
@contextlib.contextmanager
def dont_capture(request):
"""Suspend capturing of stdout by pytest."""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-services-1.3.1/pytest_services/mysql.py
new/pytest-services-2.0.1/pytest_services/mysql.py
--- old/pytest-services-1.3.1/pytest_services/mysql.py 2018-10-24
14:07:03.000000000 +0200
+++ new/pytest-services-2.0.1/pytest_services/mysql.py 2019-11-12
22:04:01.000000000 +0100
@@ -12,10 +12,12 @@
@pytest.fixture(scope='session')
-def mysql_defaults_file(run_services, mysql_data_dir, memory_temp_dir):
+def mysql_defaults_file(
+ run_services, tmp_path_factory, memory_temp_dir, request):
"""MySQL defaults file."""
if run_services:
- defaults_path = os.path.join(mysql_data_dir, 'defaults.cnf')
+ cfg = tmp_path_factory.mktemp(request.session.name)
+ defaults_path = str(cfg / 'defaults.cnf')
with open(defaults_path, 'w+') as fd:
fd.write("""
@@ -28,24 +30,36 @@
@pytest.fixture(scope='session')
-def mysql_system_database(run_services, mysql_data_dir, mysql_defaults_file,
memory_temp_dir, lock_dir, services_log):
- """Install database to given path."""
- if run_services:
- mysql_install_db = find_executable('mysql_install_db')
- assert mysql_install_db, 'You have to install mysql_install_db script.'
+def mysql_base_dir():
+ my_print_defaults = find_executable('my_print_defaults')
+ assert my_print_defaults, 'You have to install my_print_defaults script.'
+
+ return
os.path.dirname(os.path.dirname(os.path.realpath(my_print_defaults)))
- my_print_defaults = find_executable('my_print_defaults')
- assert my_print_defaults, 'You have to install my_print_defaults
script.'
- mysql_basedir =
os.path.dirname(os.path.dirname(os.path.realpath(my_print_defaults)))
[email protected](scope='session')
+def mysql_system_database(
+ run_services,
+ mysql_data_dir,
+ mysql_base_dir,
+ mysql_defaults_file,
+ memory_temp_dir,
+ lock_dir,
+ services_log,
+):
+ """Install database to given path."""
+ if run_services:
+ mysqld = find_executable('mysqld')
+ assert mysqld, 'You have to install mysqld script.'
try:
- services_log.debug('Starting mysql_install_db.')
+ services_log.debug('Starting mysqld.')
check_output([
- mysql_install_db,
+ mysqld,
'--defaults-file={0}'.format(mysql_defaults_file),
+ '--initialize-insecure',
'--datadir={0}'.format(mysql_data_dir),
- '--basedir={0}'.format(mysql_basedir),
+ '--basedir={0}'.format(mysql_base_dir),
'--user={0}'.format(os.environ['USER'])
])
except CalledProcessWithOutputError as e:
@@ -54,7 +68,7 @@
'Please ensure you disabled apparmor for /run/shm/** or for
whole mysql'.format(e=e))
raise
finally:
- services_log.debug('mysql_install_db was executed.')
+ services_log.debug('mysqld was executed.')
@pytest.fixture(scope='session')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-services-1.3.1/pytest_services/service.py
new/pytest-services-2.0.1/pytest_services/service.py
--- old/pytest-services-1.3.1/pytest_services/service.py 2018-10-24
14:07:03.000000000 +0200
+++ new/pytest-services-2.0.1/pytest_services/service.py 2019-11-12
22:04:01.000000000 +0100
@@ -58,10 +58,10 @@
Add finalizer to properly stop it.
"""
orig_request = request
+
def watcher_getter_function(name, arguments=None, kwargs=None, timeout=20,
checker=None, request=None):
if request is None:
- warnings.warn('Omitting the `request` parameter will result in an '
- 'unstable order of finalizers.')
+ warnings.warn('Omitting the `request` parameter will result in an
unstable order of finalizers.')
request = orig_request
executable = find_executable(name)
assert executable, 'You have to install {0} executable.'.format(name)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-services-1.3.1/pytest_services/xvfb.py
new/pytest-services-2.0.1/pytest_services/xvfb.py
--- old/pytest-services-1.3.1/pytest_services/xvfb.py 2018-10-24
14:07:03.000000000 +0200
+++ new/pytest-services-2.0.1/pytest_services/xvfb.py 2019-11-12
22:04:01.000000000 +0100
@@ -1,6 +1,5 @@
"""Fixtures for the GUI environment."""
import os
-import fcntl
import socket
import re
try:
@@ -71,7 +70,7 @@
listen_args = []
with file_lock(os.path.join(lock_dir,
'xvfb_{0}.lock'.format(xvfb_display)),
- operation=fcntl.LOCK_EX | fcntl.LOCK_NB):
+ ):
def checker():
try:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-services-1.3.1/requirements-testing.txt
new/pytest-services-2.0.1/requirements-testing.txt
--- old/pytest-services-1.3.1/requirements-testing.txt 2018-10-24
14:07:03.000000000 +0200
+++ new/pytest-services-2.0.1/requirements-testing.txt 2019-11-12
22:04:01.000000000 +0100
@@ -4,6 +4,4 @@
mysqlclient
pylibmc
pytest-pep8
-pylama
-pylama_pylint
astroid
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-services-1.3.1/setup.py
new/pytest-services-2.0.1/setup.py
--- old/pytest-services-1.3.1/setup.py 2018-10-24 14:07:03.000000000 +0200
+++ new/pytest-services-2.0.1/setup.py 2019-11-12 22:04:01.000000000 +0100
@@ -19,6 +19,7 @@
'requests',
'psutil',
'pytest',
+ 'zc.lockfile >= 2.0',
]
PY2 = sys.version_info[0] < 3
@@ -52,7 +53,7 @@
'Topic :: Utilities',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
- ] + [('Programming Language :: Python :: %s' % x) for x in '2.7 3.0 3.1
3.2 3.3 3.4'.split()],
+ ] + [('Programming Language :: Python :: %s' % x) for x in '2.7 3.4 3.5
3.6 3.7'.split()],
tests_require=['tox'],
entry_points={'pytest11': [
'pytest-services=pytest_services.plugin',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-services-1.3.1/tests/test_plugin.py
new/pytest-services-2.0.1/tests/test_plugin.py
--- old/pytest-services-1.3.1/tests/test_plugin.py 2018-10-24
14:07:03.000000000 +0200
+++ new/pytest-services-2.0.1/tests/test_plugin.py 2019-11-12
22:04:01.000000000 +0100
@@ -13,13 +13,13 @@
assert mc.get('some') == 1
# check memcached cleaner
- request.getfuncargvalue('memcached_clean')
+ request.getfixturevalue('memcached_clean')
assert mc.get('some') is None
-def test_mysql(mysql, mysql_connection):
+def test_mysql(mysql, mysql_connection, mysql_socket):
"""Test mysql service."""
- conn = MySQLdb.connect(user='root')
+ conn = MySQLdb.connect(user='root', unix_socket=mysql_socket)
assert conn
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-services-1.3.1/tox.ini
new/pytest-services-2.0.1/tox.ini
--- old/pytest-services-1.3.1/tox.ini 2018-10-24 14:07:03.000000000 +0200
+++ new/pytest-services-2.0.1/tox.ini 2019-11-12 22:04:01.000000000 +0100
@@ -1,59 +1,41 @@
[tox]
distshare={homedir}/.tox/distshare
-envlist=linters,py27,py27-xdist,py27-pytest-latest,py34
+envlist=
+ linters
+ py27-pytest{39,310,latest}
+ py{34,35,36}-pytestlatest
+ py27-pytestlatest-xdist
+ py27-pytestlatest-coveralls
skip_missing_interpreters = true
[testenv]
-commands= py.test tests --junitxml={envlogdir}/junit-{envname}.xml
+commands= py.test tests --junitxml={envlogdir}/junit-{envname}.xml {posargs}
deps =
- -e.
+ pytestlatest: pytest
+ pytest310: pytest~=3.10.0
+ pytest39: pytest~=3.9.0
+ xdist: pytest-xdist
-r{toxinidir}/requirements-testing.txt
passenv = DISPLAY COVERALLS_REPO_TOKEN USER TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
extras = memcache
[testenv:linters]
basepython=python2.7
-commands={[testenv]commands} pytest_services --pylama
+commands={[testenv]commands} pytest_services --pep8 -m pep8
-[testenv:coveralls]
+[testenv:py27-pytestlatest-coveralls]
+usedevelop = True
deps =
{[testenv]deps}
coveralls
commands=
- coverage run --source=pytest_services {envdir}/bin/py.test tests
+ coverage run --source=pytest_services --branch -m pytest tests
coverage report -m
coveralls
-[testenv:py27-xdist]
-basepython=python2.7
-deps =
- {[testenv]deps}
- pytest-xdist
-commands=
- py.test tests -n1 -rfsxX \
- --junitxml={envlogdir}/junit-{envname}.xml
-
-[testenv:py27-pytest-latest]
-basepython=python2.7
-deps =
- {[testenv]deps}
- git+https://github.com/pytest-dev/py.git@master#egg=py
- git+https://github.com/pytest-dev/pytest.git@features#egg=pytest
+[testenv:py27-pytestlatest-xdist]
+commands={[testenv]commands} -n1 -rfsxX
[pytest]
+pep8maxlinelength=120
addopts = -vvl
-
-[pylama]
-format = pep8
-skip = */.tox/*,*/.env/*
-linters = pylint,mccabe,pep8,pep257
-ignore =
F0401,C0111,E731,D100,W0621,W0108,R0201,W0401,W0614,W0212,C901,R0914,I0011,D211
-
-[pylama:pep8]
-max_line_length = 120
-
-[pylama:pylint]
-max_line_length = 120
-
-[pylama:mccabe]
-max_complexity = 11