summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2023-02-10 14:18:54 +0100
committerMichał Górny <mgorny@gentoo.org>2023-02-12 20:00:42 +0100
commitbe152335ee2cf11dc33378c2903873ad742e8116 (patch)
tree6b0702b5a776c440f837e8bd0663bfff1f4f17f9 /eclass/tests
parentpypi.eclass: Use pypi_sdist_url to generate the default SRC_URI (diff)
downloadgentoo-be152335ee2cf11dc33378c2903873ad742e8116.tar.gz
gentoo-be152335ee2cf11dc33378c2903873ad742e8116.tar.bz2
gentoo-be152335ee2cf11dc33378c2903873ad742e8116.zip
pypi.eclass: Add a name normalization function
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/tests')
-rwxr-xr-xeclass/tests/pypi.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/eclass/tests/pypi.sh b/eclass/tests/pypi.sh
new file mode 100755
index 000000000000..67b2c3c481fb
--- /dev/null
+++ b/eclass/tests/pypi.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+# Copyright 2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+source tests-common.sh || exit
+
+inherit pypi
+
+test-eq() {
+ local call=${1}
+ local exp=${2}
+
+ tbegin "${call} -> ${exp}"
+ local ret=0
+ local have=$(${call})
+ if [[ ${have} != ${exp} ]]; then
+ eindent
+ eerror "incorrect result: ${have}"
+ eoutdent
+ ret=1
+ fi
+ tend "${ret}"
+}
+
+test-eq "pypi_normalize_name foo" foo
+test-eq "pypi_normalize_name foo_bar" foo_bar
+test-eq "pypi_normalize_name foo___bar" foo_bar
+test-eq "pypi_normalize_name Flask-BabelEx" flask_babelex
+test-eq "pypi_normalize_name jaraco.context" jaraco_context
+
+texit