aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Polański <michal@polanski.me>2022-07-06 23:10:30 +0200
committerBart Ribbers <bribbers@disroot.org>2022-07-07 08:09:09 +0000
commitfcf58b92f218d04aaaf72e2e6e2bfb60237292ef (patch)
tree81ac9b6a186775a8c5d181012f94873daef746be
parent5d2b8d150a21d8b8160214649321ad78a5ec91eb (diff)
community/py3-sybil: upgrade to 3.0.1
-rw-r--r--community/py3-sybil/APKBUILD13
-rw-r--r--community/py3-sybil/fix-tests-for-python-3-10.patch149
2 files changed, 5 insertions, 157 deletions
diff --git a/community/py3-sybil/APKBUILD b/community/py3-sybil/APKBUILD
index 8dd73a031bb..7d00efdb6d7 100644
--- a/community/py3-sybil/APKBUILD
+++ b/community/py3-sybil/APKBUILD
@@ -1,22 +1,20 @@
# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=py3-sybil
-pkgver=2.0.1
-pkgrel=2
+pkgver=3.0.1
+pkgrel=0
pkgdesc="Automated testing for the examples in your documentation"
url="https://github.com/cjw296/sybil"
arch="noarch"
license="MIT"
depends="python3"
makedepends="
- py3-nose
py3-setuptools
py3-sphinx
py3-wheel
"
checkdepends="py3-pytest"
-source="https://pypi.python.org/packages/source/s/sybil/sybil-$pkgver.tar.gz
- fix-tests-for-python-3-10.patch"
+source="https://pypi.python.org/packages/source/s/sybil/sybil-$pkgver.tar.gz"
builddir="$srcdir/sybil-$pkgver"
build() {
@@ -24,7 +22,7 @@ build() {
}
check() {
- PYTHONPATH="$PWD/build/lib" pytest --deselect tests/test_doc_example.py::test_pytest
+ PYTHONPATH="$PWD/build/lib" pytest
}
package() {
@@ -32,6 +30,5 @@ package() {
}
sha512sums="
-4f3be7686c1acf6812623a756fa79b41e3fbe5d4c3b4c7cf5dfe39fbe56806b4ef3acd24e25968ab9119b2c65ad5c30eabe32f1a93fb62ba8d3893ef123e69f0 sybil-2.0.1.tar.gz
-1dc373b048828e37a73dd6130b4b70d06f99eb670a3d2da6c63e917f32f87fe1c5a20fa7f495e6c579b6c0057073d41d399d67e05bc9abd37f338e1636e05b84 fix-tests-for-python-3-10.patch
+312c57f0de646b1e7a3b992806362c1020b2d567c805d248e94ab22a336a8fc77704234e123e1ec74987bfea620b2f8c4d3714d32aee03587c615d3d90fe5558 sybil-3.0.1.tar.gz
"
diff --git a/community/py3-sybil/fix-tests-for-python-3-10.patch b/community/py3-sybil/fix-tests-for-python-3-10.patch
deleted file mode 100644
index b261140173c..00000000000
--- a/community/py3-sybil/fix-tests-for-python-3-10.patch
+++ /dev/null
@@ -1,149 +0,0 @@
-From 3650f5e609a6da7e114224a578e4182e262cdec5 Mon Sep 17 00:00:00 2001
-From: Chris Withers <chris@simplistix.co.uk>
-Date: Tue, 5 Oct 2021 08:29:21 +0100
-Subject: [PATCH] More specific pattern matching to help with Python 3.10
-
----
- tests/test_functional.py | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/tests/test_functional.py b/tests/test_functional.py
-index 6e77053..5bebfdb 100644
---- a/tests/test_functional.py
-+++ b/tests/test_functional.py
-@@ -15,7 +15,7 @@ def __init__(self, text):
- self.index = 0
-
- def then_find(self, substring):
-- assert substring in self.text[self.index:]
-+ assert substring in self.text[self.index:], self.text[self.index:]
- self.index = self.text.index(substring, self.index)
-
-
-@@ -99,14 +99,14 @@ def pytest_sessionfinish(self, session):
- 'sybil teardown 4\n'
- 'session_fixture teardown')
- out.then_find('_ fail.rst line=1 column=1 _')
-- out.then_find( "> raise Exception('the start!')")
-+ out.then_find("raise Exception('the start!')")
- out.then_find('_ fail.rst line=8 column=1 _')
- out.then_find('Y count was 3 instead of 2')
- out.then_find('fail.rst:8: SybilFailure')
- out.then_find('_ fail.rst line=10 column=1 _')
- out.then_find('ValueError: X count was 3 instead of 4')
- out.then_find('_ fail.rst line=14 column=1 _')
-- out.then_find("> raise Exception('boom!')")
-+ out.then_find("raise Exception('boom!')")
- out.then_find('fail.rst:18: Exception')
-
-
-From 4c12bfc0340a77cbe6496ebcef2fc777006a9c0e Mon Sep 17 00:00:00 2001
-From: Chris Withers <chris@simplistix.co.uk>
-Date: Tue, 5 Oct 2021 10:42:15 +0100
-Subject: [PATCH] Restructure tests to clarify that the line numbers and
- filenames need to be correct in exceptions.
-
----
- tests/helpers.py | 10 ++++++++
- tests/samples/codeblock_future_imports.txt | 4 +--
- tests/test_codeblock.py | 30 ++++++++--------------
- 3 files changed, 22 insertions(+), 22 deletions(-)
-
-diff --git a/tests/helpers.py b/tests/helpers.py
-index 1f3d7dc..d96fe56 100644
---- a/tests/helpers.py
-+++ b/tests/helpers.py
-@@ -1,5 +1,8 @@
- from io import open
- from os.path import dirname, join
-+from traceback import TracebackException
-+
-+from _pytest._code import ExceptionInfo
-
- from sybil.document import Document
- from sybil.example import Example
-@@ -23,3 +26,10 @@ def evaluate_region(region, namespace):
- region=region,
- namespace=namespace
- ))
-+
-+
-+def check_excinfo(excinfo: ExceptionInfo, text: str, *, lineno: int, filename: str = '/the/path'):
-+ assert str(excinfo.value) == text, f'{str(excinfo.value)!r} == {text!r}'
-+ details = TracebackException.from_exception(excinfo.value, lookup_lines=False).stack[-1]
-+ assert details.filename == filename, f'{details.filename!r} == {filename!r}'
-+ assert details.lineno == lineno, f'{details.lineno} == {lineno}'
-diff --git a/tests/samples/codeblock_future_imports.txt b/tests/samples/codeblock_future_imports.txt
-index c59a541..22412ed 100644
---- a/tests/samples/codeblock_future_imports.txt
-+++ b/tests/samples/codeblock_future_imports.txt
-@@ -1,9 +1,9 @@
- .. invisible-code-block: python
-
-- print('pathalogical worst case for line numbers', file=buffer)
-+ raise Exception('Boom 1')
-
- More likely is one down here:
-
- .. code-block:: python
-
-- print('still should work and have good line numbers', file=buffer)
-+ raise Exception('Boom 2')
-diff --git a/tests/test_codeblock.py b/tests/test_codeblock.py
-index 9196fb5..9aab10e 100644
---- a/tests/test_codeblock.py
-+++ b/tests/test_codeblock.py
-@@ -2,7 +2,7 @@
- from io import StringIO
- from sybil.document import Document
- from sybil.parsers.codeblock import CodeBlockParser, compile_codeblock
--from tests.helpers import document_from_sample, evaluate_region
-+from .helpers import document_from_sample, evaluate_region, check_excinfo
-
-
- def test_basic():
-@@ -16,7 +16,7 @@ def test_basic():
- assert namespace['z'] == 0
- with pytest.raises(Exception) as excinfo:
- evaluate_region(regions[1], namespace)
-- assert str(excinfo.value) == 'boom!'
-+ check_excinfo(excinfo, 'boom!', lineno=11)
- assert evaluate_region(regions[2], namespace) is None
- assert namespace['y'] == 1
- assert namespace['z'] == 1
-@@ -32,27 +32,17 @@ def test_basic():
- assert '__builtins__' not in namespace
-
-
--def test_future_imports():
-+def test_line_numbers_correct_with_future_imports():
- document = document_from_sample('codeblock_future_imports.txt')
- regions = list(CodeBlockParser(['print_function'])(document))
- assert len(regions) == 2
-- buffer = StringIO()
-- namespace = {'buffer': buffer}
-- assert evaluate_region(regions[0], namespace) is None
-- assert buffer.getvalue() == (
-- 'pathalogical worst case for line numbers\n'
-- )
-- # the future import line drops the firstlineno by 1
-- code = compile_codeblock(regions[0].parsed, document.path)
-- assert code.co_firstlineno == 2
-- assert evaluate_region(regions[1], namespace) is None
-- assert buffer.getvalue() == (
-- 'pathalogical worst case for line numbers\n'
-- 'still should work and have good line numbers\n'
-- )
-- # the future import line drops the firstlineno by 1
-- code = compile_codeblock(regions[1].parsed, document.path)
-- assert code.co_firstlineno == 8
-+ namespace = {}
-+ with pytest.raises(Exception) as excinfo:
-+ evaluate_region(regions[0], namespace)
-+ check_excinfo(excinfo, 'Boom 1', lineno=3)
-+ with pytest.raises(Exception) as excinfo:
-+ evaluate_region(regions[1], namespace)
-+ check_excinfo(excinfo, 'Boom 2', lineno=9)
-
-
- def test_windows_line_endings(tmp_path):