From b38c0ff5949c24eff42b042d80d34b7c10a68011 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 30 Sep 2020 23:32:30 +0200 Subject: [PATCH] CI: Add dns-lexicon to tests new things This tests: - https://bugzilla.redhat.com/show_bug.cgi?id=1877977 - https://bugzilla.redhat.com/show_bug.cgi?id=1877978 Unfortunately it is impossible to use this spec to test things on Fedora 31/32, so we skip the tests there. We keep python-requests.spec for now to test Fedora 31/32, but it can be removed after Fedora 32 EOL. --- tests/python-dns-lexicon.spec | 73 +++++++++++++++++++++++++++++++++++ tests/python-requests.spec | 2 + tests/tests.yml | 3 ++ 3 files changed, 78 insertions(+) create mode 100644 tests/python-dns-lexicon.spec diff --git a/tests/python-dns-lexicon.spec b/tests/python-dns-lexicon.spec new file mode 100644 index 0000000..801a904 --- /dev/null +++ b/tests/python-dns-lexicon.spec @@ -0,0 +1,73 @@ +Name: python-dns-lexicon +Version: 3.4.0 +Release: 0%{?dist} +Summary: Manipulate DNS records on various DNS providers in a standardized/agnostic way +License: MIT +URL: https://github.com/AnalogJ/lexicon +Source0: %{url}/archive/v%{version}/lexicon-%{version}.tar.gz +BuildArch: noarch + +BuildRequires: pyproject-rpm-macros +BuildRequires: python3-devel + +%description +This package has extras specified in tox configuration, +we test that the extras are installed when -e is used. +This package also uses a custom toxenv and creates several extras subpackages. + + +%package -n python3-dns-lexicon +Summary: %{summary} + +%description -n python3-dns-lexicon +... + + +%pyproject_extras_subpackage -n python3-dns-lexicon plesk route53 + + +%prep +%autosetup -n lexicon-%{version} +# The tox configuration lists a [dev] extra, but that installs nothing (is missing). +# The test requirements are only specified via poetry.dev-dependencies. +# Here we amend the data a bit so we can test more things, adding the tests deps to the dev extra: +sed -i \ +'s/\[tool.poetry.extras\]/'\ +'pytest = {version = ">3", optional = true}\n'\ +'vcrpy = {version = ">1", optional = true}\n\n'\ +'[tool.poetry.extras]\n'\ +'dev = ["pytest", "vcrpy"]/' pyproject.toml + + +%generate_buildrequires +%if 0%{?fedora} >= 33 || 0%{?rhel} >= 9 +# We use the "light" toxenv because the default one installs the [full] extra and we don't have all the deps. +# Note that [full] contains [plesk] and [route53] but we specify them manually instead: +%pyproject_buildrequires -e light -x plesk -x route53 +%else +# older Fedora don't have the required runtime dependencies, so we don't test it there +%pyproject_buildrequires +%endif + + +%build +%pyproject_wheel + + +%install +%pyproject_install +%pyproject_save_files lexicon + + +%if 0%{?fedora} >= 33 || 0%{?rhel} >= 9 +%check +# we cannot use %%tox here, because the configured commands call poetry directly :/ +# we use %%pytest instead, running a subset of tests not o waste CI time +%pytest -k "test_route53 or test_plesk" +%endif + + +%files -n python3-dns-lexicon -f %{pyproject_files} +%license LICENSE +%doc README.rst +%{_bindir}/lexicon diff --git a/tests/python-requests.spec b/tests/python-requests.spec index 998668c..d9f9d73 100644 --- a/tests/python-requests.spec +++ b/tests/python-requests.spec @@ -14,6 +14,8 @@ BuildRequires: pyproject-rpm-macros %description This package uses multiple extras in %%pyproject_extras_subpkg and in %%pyproject_buildrequires. +This test is mostly obsoleted by python-dns-lexicon.spec on Fedora 33+, +but we keep it around until Fedora 32 EOL. %package -n python3-requests diff --git a/tests/tests.yml b/tests/tests.yml index 94ad7fb..65ed9fc 100644 --- a/tests/tests.yml +++ b/tests/tests.yml @@ -64,6 +64,9 @@ - printrun: dir: . run: ./mocktest.sh printrun + - dns_lexicon: + dir: . + run: ./mocktest.sh python-dns-lexicon required_packages: - mock - rpmdevtools