diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2020-05-17 14:32:10 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2020-05-17 14:32:10 +0100 |
commit | 51c50bd4c895ebf56d81fecae8e45ec3b5fc3efa (patch) | |
tree | 753b6b08624c34d1ed8414bbe22c45409f7741b9 /dev-python/snapshottest | |
parent | be9d77d3ac6af8f4ead98d89706f356b65578c93 (diff) | |
parent | deba8115d2c2af26df42966b91ef04ff4dd79cde (diff) |
Merge branch 'edge' into next
Diffstat (limited to 'dev-python/snapshottest')
-rw-r--r-- | dev-python/snapshottest/Manifest | 4 | ||||
-rw-r--r-- | dev-python/snapshottest/files/snapshottest-0.5.1-remove-fastdiff.patch | 57 | ||||
-rw-r--r-- | dev-python/snapshottest/metadata.xml | 12 | ||||
-rw-r--r-- | dev-python/snapshottest/snapshottest-0.5.1.ebuild | 49 |
4 files changed, 122 insertions, 0 deletions
diff --git a/dev-python/snapshottest/Manifest b/dev-python/snapshottest/Manifest new file mode 100644 index 000000000000..7e6d15af53dc --- /dev/null +++ b/dev-python/snapshottest/Manifest @@ -0,0 +1,4 @@ +AUX snapshottest-0.5.1-remove-fastdiff.patch 1978 BLAKE2B 49bbd2118bd8defc3134b1863614a6da7f45f8702c9b65db35329a74b270a511ef6c87952eafefa5e64080c136e21fe7abbfb1e304ff1744983bfa6fcbcc27ee SHA512 804223af644f67a7ad22996572bdb35c88d3c87bfd67ef821b4ebcfb581281f305f9d96edfda9d8a20d5cd1d07397899dc10b629f7d02b91c2b8804e02fd1ac0 +DIST snapshottest-0.5.1.tar.gz 19312 BLAKE2B a8acfb09de9e58c7a929f71d10f3cc68d7eec31a9fa1ea0fe74ae8a574ceec315f7eab2f9e7cd326c34d981b5ede4c398b5f1352bd59c23be219eeb9a2c0e861 SHA512 1541c327c4238c816b55cf797f6104ad54ff62a2332517b3bf9a455bbee0abd49f6983a54dc7510d1e1c659d88e5f7d6c6aa396c0ece19e19957ea8cff42c673 +EBUILD snapshottest-0.5.1.ebuild 1261 BLAKE2B 999553c2154032ff0734263eff74db28e9fbd085bc1723e034e60e425e18fee14e72461d78c064794474ce1707c7a209ded62ca10e31b6fe8deb9d3de975377e SHA512 8cce1a9e48ea066f2d6e266b35309a56ec99a8984695336c936a238055acccfb29a5e93e750efb8dd45771cc400f51ea55cd29751534f1efd119a73d168acf5d +MISC metadata.xml 407 BLAKE2B cf0e92bcd492b79892ebc97b7639c016b4d1853a87bed8fcd1e367a9f6cbadce01015895d22011425aba76a4895b245bee0e5536fc959224a6bed08daef74a88 SHA512 155696e449933084fbe56dd900e15d17e12d52d6af29eb4fcb6c05ddfe8c6fa716974fa27085c34ae2e1af0d1739dba2616eb12092c606b2645f2008e51d64a3 diff --git a/dev-python/snapshottest/files/snapshottest-0.5.1-remove-fastdiff.patch b/dev-python/snapshottest/files/snapshottest-0.5.1-remove-fastdiff.patch new file mode 100644 index 000000000000..ec12f15fe7a6 --- /dev/null +++ b/dev-python/snapshottest/files/snapshottest-0.5.1-remove-fastdiff.patch @@ -0,0 +1,57 @@ +From 3e31b54d349eb136f0d96eb81309fdaf4ad35fcf Mon Sep 17 00:00:00 2001 +From: David Shepherd <davidshepherd7@gmail.com> +Date: Sat, 15 Feb 2020 11:48:52 +0000 +Subject: [PATCH] Revert "Use fastdiff for faster diffing" + +This reverts commit 56d9efdaa37c39c7f644726e0d34c89b09ff9568. +--- + setup.py | 2 +- + snapshottest/diff.py | 9 +++++---- + 2 files changed, 6 insertions(+), 5 deletions(-) + +diff --git a/setup.py b/setup.py +index 1baefd8..690713e 100644 +--- a/setup.py ++++ b/setup.py +@@ -23,7 +23,7 @@ + 'nose.plugins.0.10': + ['snapshottest = snapshottest.nose:SnapshotTestPlugin'] + }, +- install_requires=['six>=1.10.0', 'termcolor', 'fastdiff>=0.1.4<1'], ++ install_requires=['six>=1.10.0', 'termcolor'], + tests_require=tests_require, + extras_require={ + 'test': tests_require, +diff --git a/snapshottest/diff.py b/snapshottest/diff.py +index 5fddf66..83c599a 100644 +--- a/snapshottest/diff.py ++++ b/snapshottest/diff.py +@@ -1,5 +1,5 @@ ++from difflib import Differ + from termcolor import colored +-from fastdiff import compare + + from .sorted_dict import SortedDict + from .formatter import Formatter +@@ -23,6 +23,7 @@ def format_line(line): + class PrettyDiff(object): + def __init__(self, obj, snapshottest): + self.pretty = Formatter() ++ self.differ = Differ() + self.snapshottest = snapshottest + if isinstance(obj, dict): + obj = SortedDict(**obj) +@@ -35,10 +36,10 @@ def __repr__(self): + return repr(self.obj) + + def get_diff(self, other): +- text1 = 'Received \n\n' + self.pretty(self.obj) +- text2 = 'Snapshot \n\n' + self.pretty(other) ++ text1 = ['Received ', ''] + self.pretty(self.obj).splitlines(1) ++ text2 = ['Snapshot ', ''] + self.pretty(other).splitlines(1) + +- lines = list(compare(text2, text1)) ++ lines = list(self.differ.compare(text2, text1)) + return [ + format_line(line) for line in lines + ] diff --git a/dev-python/snapshottest/metadata.xml b/dev-python/snapshottest/metadata.xml new file mode 100644 index 000000000000..592df77578dc --- /dev/null +++ b/dev-python/snapshottest/metadata.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>python@gentoo.org</email> + <name>Python</name> + </maintainer> + <upstream> + <remote-id type="pypi">sphinxcontrib-httpdomain</remote-id> + <remote-id type="bitbucket">birkenfeld/sphinx-contrib</remote-id> + </upstream> +</pkgmetadata> diff --git a/dev-python/snapshottest/snapshottest-0.5.1.ebuild b/dev-python/snapshottest/snapshottest-0.5.1.ebuild new file mode 100644 index 000000000000..f460c89932af --- /dev/null +++ b/dev-python/snapshottest/snapshottest-0.5.1.ebuild @@ -0,0 +1,49 @@ +# Copyright 2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{6,7,8} ) +DISTUTILS_USE_SETUPTOOLS=rdepend +inherit distutils-r1 + +# no tests on pypi, no tags on github +COMMIT_HASH="4ac2b4fb09e9e7728bebb11967c164a914775d1d" + +DESCRIPTION="Snapshot Testing utils for Python" +HOMEPAGE="https://pypi.org/project/snapshottest/ + https://github.com/syrusakbary/snapshottest" +SRC_URI="https://github.com/syrusakbary/${PN}/archive/${COMMIT_HASH}.tar.gz -> ${P}.tar.gz" +S="${WORKDIR}/${PN}-${COMMIT_HASH}" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="test" +RESTRICT="!test? ( test )" + +RDEPEND=" + dev-python/six[${PYTHON_USEDEP}] + dev-python/termcolor[${PYTHON_USEDEP}] +" +BDEPEND="${RDEPEND} + test? ( + dev-python/pytest[${PYTHON_USEDEP}] + ) +" + +PATCHES=( + "${FILESDIR}/snapshottest-0.5.1-remove-fastdiff.patch" +) + +python_prepare_all() { + sed -e "s:'pytest-runner'(,|)::" -i setup.py || die + sed -r -e 's:--cov[[:space:]]*[[:graph:]]+::g' -i setup.cfg || die + distutils-r1_python_prepare_all +} + +python_test() { + distutils_install_for_testing + pytest -vv tests examples/pytest || die "Tests failed with ${EPYTHON}" + "${EPYTHON}" examples/unittest/test_demo.py || die "Tests failed with ${EPYTHON}" +} |