From c5cc3a8378d65db98ac879b76eac4469f8d262c0 Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Tue, 21 Dec 2021 18:54:36 +0100 Subject: [PATCH 1/5] Use new sybil 3 name for codeblock parser if available --- testfixtures/tests/conftest.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/testfixtures/tests/conftest.py b/testfixtures/tests/conftest.py index 97036fbc..2046d884 100644 --- a/testfixtures/tests/conftest.py +++ b/testfixtures/tests/conftest.py @@ -1,6 +1,10 @@ from sybil import Sybil from sybil.parsers.doctest import DocTestParser -from sybil.parsers.codeblock import CodeBlockParser +try: + from sybil.parsers.codeblock import PythonCodeBlockParser +except ImportError: + # sybil < 3 has it under the old name + from sybil.parsers.codeblock import CodeBlockParser as PythonCodeBlockParser from sybil.parsers.capture import parse_captures from testfixtures import TempDirectory @@ -18,7 +22,7 @@ def sybil_teardown(namespace): pytest_collect_file = Sybil( parsers=[ DocTestParser(), - CodeBlockParser(), + PythonCodeBlockParser(), parse_captures, FileParser('tempdir'), ], From 5feb7117ec7883b6bd302f3447ba0c974a146814 Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Tue, 21 Dec 2021 18:57:09 +0100 Subject: [PATCH 2/5] unpin sybil --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 02d66665..ceae0fae 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ 'zope.component', 'django<2;python_version<"3"', 'django;python_version>="3"', - 'sybil<3', + 'sybil', 'twisted' ] From bcff79824236bcda8623fef20347fd98c33d49ac Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Tue, 21 Dec 2021 19:05:00 +0100 Subject: [PATCH 3/5] cater for sybil 3 API change --- docs/conftest.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/conftest.py b/docs/conftest.py index ef79733c..d1dcfc75 100644 --- a/docs/conftest.py +++ b/docs/conftest.py @@ -1,8 +1,16 @@ from doctest import REPORT_NDIFF, ELLIPSIS from sybil import Sybil -from sybil.parsers.doctest import DocTestParser, FIX_BYTE_UNICODE_REPR -from sybil.parsers.codeblock import CodeBlockParser +from sybil.parsers.doctest import DocTestParser +try: + from sybil.parsers.doctest import FIX_BYTE_UNICODE_REPR +except ImportError: + # sybil 3 removed the optionflag + FIX_BYTE_UNICODE_REPR = 0 +try: + from sybil.parsers.codeblock import PythonCodeBlockParser +except ImportError: + from sybil.parsers.codeblock import CodeBlockParser as PythonCodeBlockParser from sybil.parsers.capture import parse_captures from testfixtures.compat import PY3 @@ -13,7 +21,7 @@ pytest_collect_file = Sybil( parsers=[ DocTestParser(optionflags=REPORT_NDIFF|ELLIPSIS|FIX_BYTE_UNICODE_REPR), - CodeBlockParser(['print_function']), + PythonCodeBlockParser(['print_function']), parse_captures, FileParser('tempdir'), ], From daa5c39de981a044697a6fcbf0760150a445287b Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Tue, 21 Dec 2021 19:09:03 +0100 Subject: [PATCH 4/5] change byte unicode return --- docs/django.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/django.txt b/docs/django.txt index 2f289fee..01419b4b 100755 --- a/docs/django.txt +++ b/docs/django.txt @@ -23,7 +23,7 @@ Traceback (most recent call last): AssertionError: SampleModel not as expected: same: -[u'id'] +['id'] values differ: 'value': 1 != 2 @@ -38,7 +38,7 @@ Traceback (most recent call last): AssertionError: SampleModel not as expected: same: -[u'id'] +['id'] values differ: 'value': 1 != 2 @@ -70,7 +70,7 @@ Traceback (most recent call last): AssertionError: SampleModel not as expected: same: -['created', u'id', 'value'] +['created', 'id', 'value'] values differ: 'not_editable': 1 != 2 From 0c1d79f8a71b56b761ae7617888038187e1b0f13 Mon Sep 17 00:00:00 2001 From: Chris Withers Date: Fri, 25 Feb 2022 09:53:55 +0000 Subject: [PATCH 5/5] Make sure we test against sybil2 and pytest6 --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 86027987..eb1ff41e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -33,6 +33,7 @@ common: &common - python/pip-run-tests: name: python36 image: cimg/python:3.6 + extra_packages: "'sybil<3' 'pytest<7'" - python/pip-run-tests: name: python39 image: cimg/python:3.9