[Python-modules-commits] [pytest-xvfb] 02/03: Initial debianisation
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Thu Feb 9 12:34:10 UTC 2017
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch master
in repository pytest-xvfb.
commit 31acd72c9e2c704067eb9457dcae387a672559b5
Author: Ghislain Antony Vaillant <ghisvail at gmail.com>
Date: Thu Feb 9 11:09:37 2017 +0000
Initial debianisation
---
debian/changelog | 5 +
debian/clean | 1 +
debian/compat | 1 +
debian/control | 29 ++++
debian/copyright | 31 ++++
debian/gbp.conf | 7 +
debian/patches/Add-missing-test-suite.patch | 260 ++++++++++++++++++++++++++++
debian/patches/series | 1 +
debian/rules | 11 ++
debian/source/format | 1 +
debian/tests/control | 4 +
debian/watch | 3 +
12 files changed, 354 insertions(+)
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..953cb01
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+pytest-xvfb (1.0.0-1) UNRELEASED; urgency=low
+
+ * Initial release. (Closes: #854673)
+
+ -- Ghislain Antony Vaillant <ghisvail at gmail.com> Thu, 09 Feb 2017 10:51:52 +0000
diff --git a/debian/clean b/debian/clean
new file mode 100644
index 0000000..45149aa
--- /dev/null
+++ b/debian/clean
@@ -0,0 +1 @@
+*.egg-info/*
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..f599e28
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+10
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..adb87a8
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,29 @@
+Source: pytest-xvfb
+Maintainer: Debian Python Modules Team <python-modules-team at lists.alioth.debian.org>
+Uploaders: Ghislain Antony Vaillant <ghisvail at gmail.com>
+Section: python
+Priority: optional
+Build-Depends: debhelper (>= 10),
+ dh-python,
+ python3-all,
+ python3-pytest (>= 2.8.1),
+ python3-pyvirtualdisplay,
+ python3-setuptools
+Standards-Version: 3.9.8
+Vcs-Browser: https://anonscm.debian.org/git/python-modules/packages/pytest-xvfb.git
+Vcs-Git: https://anonscm.debian.org/git/python-modules/packages/pytest-xvfb.git
+Homepage: https://github.com/The-Compiler/pytest-xvfb
+X-Python3-Version: >= 3.3
+
+Package: python3-pytest-xvfb
+Architecture: all
+Depends: ${misc:Depends},
+ ${python3:Depends},
+ xauth,
+ xvfb
+Description: pytest plugin to run Xvfb for tests
+ With Xvfb and this plugin installed, your testsuite automatically runs with
+ Xvfb. This allows tests to be run without windows popping up during GUI tests
+ or on systems without a display (like a CI).
+ .
+ This package provides the Python 3 modules.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..8ef0bff
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,31 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: pytest-xvfb
+Upstream-Contact: Florian Bruhin <me at the-compiler.org>
+Source: https://pypi.python.org/pypi/pytest-xvfb/
+
+Files: *
+Copyright: 2016 Florian Bruhin
+License: Expat
+
+Files: debian/*
+Copyright: 2017 Ghislain Antony Vaillant <ghisvail at gmail.com>
+License: Expat
+
+License: Expat
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights to
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ of the Software, and to permit persons to whom the Software is furnished to do
+ so, subject to the following conditions:
+ .
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
diff --git a/debian/gbp.conf b/debian/gbp.conf
new file mode 100644
index 0000000..f53906f
--- /dev/null
+++ b/debian/gbp.conf
@@ -0,0 +1,7 @@
+[DEFAULT]
+upstream-branch = upstream
+debian-branch = master
+upstream-tag = upstream/%(version)s
+debian-tag = debian/%(version)s
+sign-tags = True
+pristine-tar = True
diff --git a/debian/patches/Add-missing-test-suite.patch b/debian/patches/Add-missing-test-suite.patch
new file mode 100644
index 0000000..90d3b1b
--- /dev/null
+++ b/debian/patches/Add-missing-test-suite.patch
@@ -0,0 +1,260 @@
+From: Ghislain Antony Vaillant <ghisvail at gmail.com>
+Date: Thu, 9 Feb 2017 11:15:19 +0000
+Subject: Add missing test suite
+
+---
+ tests/conftest.py | 1 +
+ tests/test_xvfb.py | 236 +++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 237 insertions(+)
+ create mode 100644 tests/conftest.py
+ create mode 100644 tests/test_xvfb.py
+
+diff --git a/tests/conftest.py b/tests/conftest.py
+new file mode 100644
+index 0000000..bc711e5
+--- /dev/null
++++ b/tests/conftest.py
+@@ -0,0 +1 @@
++pytest_plugins = 'pytester'
+diff --git a/tests/test_xvfb.py b/tests/test_xvfb.py
+new file mode 100644
+index 0000000..8a14538
+--- /dev/null
++++ b/tests/test_xvfb.py
+@@ -0,0 +1,236 @@
++# -*- coding: utf-8 -*-
++
++import os
++
++import pytest
++
++import pytest_xvfb
++
++
++xauth_available = any(
++ os.access(os.path.join(path, 'xauth'), os.X_OK)
++ for path in os.environ.get('PATH', '').split(os.pathsep)
++)
++
++
++ at pytest.fixture(autouse=True, scope='session')
++def ensure_xvfb():
++ if not pytest_xvfb.xvfb_available():
++ raise Exception("Tests need Xvfb to run.")
++
++
++def test_xvfb_available(testdir, monkeypatch):
++ monkeypatch.delenv('DISPLAY')
++ testdir.makepyfile("""
++ import os
++
++ def test_display():
++ assert 'DISPLAY' in os.environ
++ """)
++ result = testdir.runpytest()
++ assert result.ret == 0
++
++
++def test_empty_display(testdir, monkeypatch):
++ monkeypatch.setenv('DISPLAY', '')
++ testdir.makepyfile("""
++ import os
++
++ def test_display():
++ assert 'DISPLAY' in os.environ
++ """)
++ result = testdir.runpytest()
++ assert os.environ['DISPLAY'] == ''
++ assert result.ret == 0
++
++
++def test_xvfb_unavailable(testdir, monkeypatch):
++ monkeypatch.setenv('PATH', '')
++ monkeypatch.setenv('DISPLAY', ':42')
++ testdir.makepyfile("""
++ import os
++
++ def test_display():
++ assert os.environ['DISPLAY'] == ':42'
++ """)
++ assert os.environ['DISPLAY'] == ':42'
++ result = testdir.runpytest()
++ result.stdout.fnmatch_lines('* could not find Xvfb.*')
++ assert result.ret == 0
++
++
++def test_no_xvfb_arg(testdir, monkeypatch):
++ monkeypatch.setenv('DISPLAY', ':42')
++ testdir.makepyfile("""
++ import os
++
++ def test_display():
++ assert os.environ['DISPLAY'] == ':42'
++ """)
++ assert os.environ['DISPLAY'] == ':42'
++ result = testdir.runpytest('--no-xvfb')
++ assert result.ret == 0
++
++
++ at pytest.mark.parametrize('configured', [True, False])
++def test_screen_size(testdir, configured):
++ try:
++ import tkinter
++ except ImportError:
++ pytest.importorskip('Tkinter')
++
++ if configured:
++ testdir.makeini("""
++ [pytest]
++ xvfb_width = 1024
++ xvfb_height = 768
++ xvfb_colordepth = 8
++ """)
++ expected_width = 1024
++ expected_height = 768
++ expected_depth = 8
++ else:
++ expected_width = 800
++ expected_height = 600
++ expected_depth = 16
++
++ testdir.makepyfile("""
++ try:
++ import tkinter as tk
++ except ImportError:
++ import Tkinter as tk
++
++ def test_screen_size():
++ root = tk.Tk()
++ assert root.winfo_screenwidth() == {width}
++ assert root.winfo_screenheight() == {height}
++ assert root.winfo_screendepth() == {depth}
++ """.format(width=expected_width, height=expected_height,
++ depth=expected_depth))
++ result = testdir.runpytest()
++ assert result.ret == 0
++
++
++def test_failing_start(testdir, monkeypatch):
++ testdir.makeini("""
++ [pytest]
++ xvfb_args = -foo
++ """)
++ testdir.makepyfile("""
++ def test_none():
++ pass
++ """)
++ result = testdir.runpytest()
++ result.stderr.fnmatch_lines([
++ "INTERNALERROR> *XvfbExitedError: Xvfb exited with exit code 1"
++ ])
++ assert 'OSError' not in str(result.stderr)
++
++
++ at pytest.mark.parametrize('args, outcome', [
++ ([], '1 passed, 1 skipped'),
++ (['--no-xvfb'], '2 passed'),
++])
++def test_no_xvfb_marker(testdir, args, outcome):
++ testdir.makepyfile("""
++ import pytest
++
++ @pytest.mark.no_xvfb
++ def test_marked():
++ pass
++
++ def test_unmarked():
++ pass
++ """)
++ res = testdir.runpytest(*args)
++ res.stdout.fnmatch_lines('*= {0}*'.format(outcome))
++
++
++def test_xvfb_fixture(testdir):
++ testdir.makepyfile("""
++ import os
++
++ def test_display(xvfb):
++ assert ':{}'.format(xvfb.display) == os.environ['DISPLAY']
++
++ def test_screen(xvfb):
++ assert xvfb.width == 800
++ assert xvfb.height == 600
++ assert xvfb.colordepth == 16
++
++ def test_args(xvfb):
++ assert xvfb.args == []
++ """)
++ result = testdir.runpytest()
++ assert result.ret == 0
++
++
++def test_early_display(monkeypatch, testdir):
++ """Make sure DISPLAY is set in a session-scoped fixture already."""
++ monkeypatch.delenv('DISPLAY')
++ testdir.makepyfile("""
++ import os
++ import pytest
++
++ @pytest.yield_fixture(scope='session', autouse=True)
++ def fixt():
++ assert 'DISPLAY' in os.environ
++ yield
++
++ def test_foo():
++ pass
++ """)
++
++
++def test_strict_markers(testdir):
++ testdir.makepyfile("""
++ import pytest
++
++ @pytest.mark.no_xvfb
++ def test_marked():
++ pass
++ """)
++ result = testdir.runpytest('--strict')
++ assert result.ret == 0
++
++
++def test_xvfb_session_fixture(testdir):
++ """Make sure the xvfb fixture can be used from a session-wide one."""
++ testdir.makepyfile("""
++ import pytest
++
++ @pytest.fixture(scope='session')
++ def fixt(xvfb):
++ pass
++
++ def test_fixt(fixt):
++ pass
++ """)
++ result = testdir.runpytest()
++ assert result.ret == 0
++
++
++ at pytest.mark.skipif(not xauth_available, reason='no xauth')
++def test_xvfb_with_xauth(testdir):
++ original_auth = os.environ.get('XAUTHORITY')
++ testdir.makeini("""
++ [pytest]
++ xvfb_xauth = True
++ """)
++ testdir.makepyfile("""
++ import os
++
++ def test_xauth():
++ print('\\nXAUTHORITY: ' + os.environ['XAUTHORITY'])
++ assert os.path.isfile(os.environ['XAUTHORITY'])
++ assert os.access(os.environ['XAUTHORITY'], os.R_OK)
++ """)
++ result = testdir.runpytest('-s')
++ # Get and parse the XAUTHORITY: line
++ authline = next(l for l in result.outlines if l.startswith('XAUTHORITY:'))
++ authfile = authline.split(' ', 1)[1]
++
++ assert result.ret == 0
++ # Make sure the authfile is deleted
++ assert not os.path.exists(authfile)
++ assert os.environ.get('XAUTHORITY') == original_auth
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..fe60c2f
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+Add-missing-test-suite.patch
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..8cf8126
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,11 @@
+#!/usr/bin/make -f
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE = 1
+
+export PYBUILD_NAME = pytest-qt
+# The tests can only be run against the installed package.
+export PYBUILD_DISABLE = test
+
+%:
+ dh $@ --with python3 --buildsystem=pybuild
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..e1bb9d0
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,4 @@
+Test-Command: cp -a tests $AUTOPKGTEST_TMP
+ ; cd $AUTOPKGTEST_TMP
+ ; python3 -m pytest tests
+Depends: python3-pytest-xvfb, python3-tk
diff --git a/debian/watch b/debian/watch
new file mode 100644
index 0000000..887f5d3
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,3 @@
+version=4
+opts=uversionmangle=s/(rc|a|b|c)/~$1/ \
+https://pypi.debian.net/@PACKAGE@/@PACKAGE@@ANY_VERSION@@ARCHIVE_EXT@
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/pytest-xvfb.git
More information about the Python-modules-commits
mailing list