1 |
commit: 35ab04bd6c3ae865362f230cb2c870aca2e5b6d4 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jun 5 16:48:10 2022 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jun 5 16:48:57 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=35ab04bd |
7 |
|
8 |
dev-python/snapshottest: Bump to 0.6.0 |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
dev-python/snapshottest/Manifest | 1 + |
13 |
.../files/snapshottest-0.6.0-remove-fastdiff.patch | 57 ++++++++++++++++++++++ |
14 |
dev-python/snapshottest/snapshottest-0.6.0.ebuild | 44 +++++++++++++++++ |
15 |
3 files changed, 102 insertions(+) |
16 |
|
17 |
diff --git a/dev-python/snapshottest/Manifest b/dev-python/snapshottest/Manifest |
18 |
index 8b4c61498610..394a507020c5 100644 |
19 |
--- a/dev-python/snapshottest/Manifest |
20 |
+++ b/dev-python/snapshottest/Manifest |
21 |
@@ -1 +1,2 @@ |
22 |
DIST snapshottest-0.5.1.tar.gz 19312 BLAKE2B a8acfb09de9e58c7a929f71d10f3cc68d7eec31a9fa1ea0fe74ae8a574ceec315f7eab2f9e7cd326c34d981b5ede4c398b5f1352bd59c23be219eeb9a2c0e861 SHA512 1541c327c4238c816b55cf797f6104ad54ff62a2332517b3bf9a455bbee0abd49f6983a54dc7510d1e1c659d88e5f7d6c6aa396c0ece19e19957ea8cff42c673 |
23 |
+DIST snapshottest-0.6.0.gh.tar.gz 19887 BLAKE2B d85b3025731dbe80c04388f8adf755f48f428df5f15496ad7e47d436ccfba0f8955833f576b12a38a3565a56deb49a425b67f9040bce69a7711be05558f0ef4e SHA512 7477668c0a61b4c282deb3eb9105cf06e8f644c931e2860a9a60dc2f8ed6de1eaf1ab100a816de200a39db8b488bda6ad33472265eecca707360dcbc9d8fafee |
24 |
|
25 |
diff --git a/dev-python/snapshottest/files/snapshottest-0.6.0-remove-fastdiff.patch b/dev-python/snapshottest/files/snapshottest-0.6.0-remove-fastdiff.patch |
26 |
new file mode 100644 |
27 |
index 000000000000..948f961aae0b |
28 |
--- /dev/null |
29 |
+++ b/dev-python/snapshottest/files/snapshottest-0.6.0-remove-fastdiff.patch |
30 |
@@ -0,0 +1,57 @@ |
31 |
+From 3e31b54d349eb136f0d96eb81309fdaf4ad35fcf Mon Sep 17 00:00:00 2001 |
32 |
+From: David Shepherd <davidshepherd7@×××××.com> |
33 |
+Date: Sat, 15 Feb 2020 11:48:52 +0000 |
34 |
+Subject: [PATCH] Revert "Use fastdiff for faster diffing" |
35 |
+ |
36 |
+This reverts commit 56d9efdaa37c39c7f644726e0d34c89b09ff9568. |
37 |
+--- |
38 |
+ setup.py | 2 +- |
39 |
+ snapshottest/diff.py | 9 +++++---- |
40 |
+ 2 files changed, 6 insertions(+), 5 deletions(-) |
41 |
+ |
42 |
+diff --git a/setup.py b/setup.py |
43 |
+index 1baefd8..690713e 100644 |
44 |
+--- a/setup.py |
45 |
++++ b/setup.py |
46 |
+@@ -23,7 +23,7 @@ |
47 |
+ 'nose.plugins.0.10': |
48 |
+ ['snapshottest = snapshottest.nose:SnapshotTestPlugin'] |
49 |
+ }, |
50 |
+- install_requires=['six>=1.10.0', 'termcolor', 'fastdiff>=0.1.4,<1'], |
51 |
++ install_requires=['six>=1.10.0', 'termcolor'], |
52 |
+ tests_require=tests_require, |
53 |
+ extras_require={ |
54 |
+ 'test': tests_require, |
55 |
+diff --git a/snapshottest/diff.py b/snapshottest/diff.py |
56 |
+index 5fddf66..83c599a 100644 |
57 |
+--- a/snapshottest/diff.py |
58 |
++++ b/snapshottest/diff.py |
59 |
+@@ -1,5 +1,5 @@ |
60 |
++from difflib import Differ |
61 |
+ from termcolor import colored |
62 |
+-from fastdiff import compare |
63 |
+ |
64 |
+ from .sorted_dict import SortedDict |
65 |
+ from .formatter import Formatter |
66 |
+@@ -23,6 +23,7 @@ def format_line(line): |
67 |
+ class PrettyDiff(object): |
68 |
+ def __init__(self, obj, snapshottest): |
69 |
+ self.pretty = Formatter() |
70 |
++ self.differ = Differ() |
71 |
+ self.snapshottest = snapshottest |
72 |
+ if isinstance(obj, dict): |
73 |
+ obj = SortedDict(**obj) |
74 |
+@@ -35,10 +36,10 @@ def __repr__(self): |
75 |
+ return repr(self.obj) |
76 |
+ |
77 |
+ def get_diff(self, other): |
78 |
+- text1 = 'Received \n\n' + self.pretty(self.obj) |
79 |
+- text2 = 'Snapshot \n\n' + self.pretty(other) |
80 |
++ text1 = ['Received ', ''] + self.pretty(self.obj).splitlines(1) |
81 |
++ text2 = ['Snapshot ', ''] + self.pretty(other).splitlines(1) |
82 |
+ |
83 |
+- lines = list(compare(text2, text1)) |
84 |
++ lines = list(self.differ.compare(text2, text1)) |
85 |
+ return [ |
86 |
+ format_line(line) for line in lines |
87 |
+ ] |
88 |
|
89 |
diff --git a/dev-python/snapshottest/snapshottest-0.6.0.ebuild b/dev-python/snapshottest/snapshottest-0.6.0.ebuild |
90 |
new file mode 100644 |
91 |
index 000000000000..390ad2eb66f6 |
92 |
--- /dev/null |
93 |
+++ b/dev-python/snapshottest/snapshottest-0.6.0.ebuild |
94 |
@@ -0,0 +1,44 @@ |
95 |
+# Copyright 2020-2022 Gentoo Authors |
96 |
+# Distributed under the terms of the GNU General Public License v2 |
97 |
+ |
98 |
+EAPI=8 |
99 |
+ |
100 |
+DISTUTILS_USE_PEP517=setuptools |
101 |
+PYTHON_COMPAT=( python3_{8..11} ) |
102 |
+ |
103 |
+inherit distutils-r1 |
104 |
+ |
105 |
+DESCRIPTION="Snapshot Testing utils for Python" |
106 |
+HOMEPAGE=" |
107 |
+ https://github.com/syrusakbary/snapshottest/ |
108 |
+ https://pypi.org/project/snapshottest/ |
109 |
+" |
110 |
+SRC_URI=" |
111 |
+ https://github.com/syrusakbary/${PN}/archive/${PV}.tar.gz |
112 |
+ -> ${P}.gh.tar.gz |
113 |
+" |
114 |
+ |
115 |
+LICENSE="MIT" |
116 |
+SLOT="0" |
117 |
+KEYWORDS="~amd64 ~x86" |
118 |
+ |
119 |
+RDEPEND=" |
120 |
+ dev-python/six[${PYTHON_USEDEP}] |
121 |
+ dev-python/termcolor[${PYTHON_USEDEP}] |
122 |
+" |
123 |
+ |
124 |
+distutils_enable_tests pytest |
125 |
+ |
126 |
+PATCHES=( |
127 |
+ "${FILESDIR}/snapshottest-0.6.0-remove-fastdiff.patch" |
128 |
+) |
129 |
+ |
130 |
+python_prepare_all() { |
131 |
+ sed -i -e 's:--cov snapshottest::' setup.cfg || die |
132 |
+ distutils-r1_python_prepare_all |
133 |
+} |
134 |
+ |
135 |
+python_test() { |
136 |
+ epytest tests examples/pytest |
137 |
+ "${EPYTHON}" examples/unittest/test_demo.py || die "Tests failed with ${EPYTHON}" |
138 |
+} |