git » python-pycurl.git » commit dfeee8d

Switch to PEP 517

author David Runge
2024-04-10 09:06:30 UTC
committer David Runge
2024-04-10 09:06:30 UTC
parent 4174aab66b25427c4806abcf95d29c281595529e

Switch to PEP 517

Run tests in check() without ignoring their outcome, by using pytest
directly instead of relying on complicated Makefile.
Disable all broken tests.

Signed-off-by: David Runge <dvzrv@archlinux.org>

PKGBUILD +44 -7

diff --git a/PKGBUILD b/PKGBUILD
index e652d42..072abf4 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -10,7 +10,7 @@ arch=('x86_64')
 url="http://pycurl.sourceforge.net/"
 license=('LGPL-2.1-only OR MIT')
 depends=('python' 'curl')
-makedepends=('python-setuptools')
+makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel')
 checkdepends=('python-bottle' 'python-pytest' 'vsftpd' 'python-flaky' 'python-pyflakes')
 source=("https://github.com/pycurl/pycurl/archive/REL_${pkgver//./_}/$pkgname-$pkgver.tar.gz")
 sha512sums=('c27d500a310124b0972eaeb424afc2878e0cd59bec9841ec0dcff3485a76e78b53438d9bf9c035658058d7c118e3e5ecd426e0733cbd251261135c6a504f2edf')
@@ -21,20 +21,57 @@ prepare() {
 
 build() {
   cd pycurl-$pkgver
-  make
-  python setup.py build
+  # the unified source release builds (see PYCURL_RELEASE=1 in Makefile) do not work with tests
+  python -m build --wheel --no-isolation
+  # needed for tests
+  make -C tests/fake-curl/libcurl
 }
 
 check() {
-  export PYCURL_VSFTPD_PATH=vsftpd
-  # We don't have HTTP2 enabled
+  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
+  local pytest_options=(
+    -vv
+    --ignore tests/ftp_test.py  # downloads the internet
+    # hanging tests (probably also due to downloading the internet)
+    --ignore tests/multi_socket_test.py
+    --ignore tests/multi_test.py
+    --ignore tests/multi_timer_test.py
+    --deselect tests/open_socket_cb_test.py::OpenSocketCbTest::test_socket_open
+    --ignore tests/perform_test.py
+    --ignore tests/post_test.py
+    --ignore tests/read_cb_test.py
+    --ignore tests/readdata_test.py
+    --deselect tests/reset_test.py::ResetTest::test_reset
+    --deselect tests/resolve_test.py::ResolveTest::test_resolve
+    --deselect tests/seek_cb_test.py::SeekCbTest::test_seek_function
+    --deselect tests/setopt_lifecycle_test.py::SetoptLifecycleTest::test_postfields_lifecycle
+    --deselect tests/setopt_string_test.py::SetoptTest::test_setopt_string
+    --deselect tests/relative_url_test.py::RelativeUrlTest::test_get_relative
+    --deselect tests/pause_test.py::PauseTest::test_pause_via_call
+    --deselect tests/pause_test.py::PauseTest::test_pause_via_return
+    --deselect tests/setopt_test.py::SetoptTest::test_set_httpheader_none
+    --deselect tests/setopt_test.py::SetoptTest::test_unset_httpheader
+    --deselect tests/setopt_unicode_test.py::SetoptUnicodeTest::test_ascii_string
+    --deselect tests/setopt_unicode_test.py::SetoptUnicodeTest::test_unicode_encoded
+    --deselect tests/share_test.py::ShareTest::test_share
+    --deselect tests/sockopt_cb_test.py::SockoptCbTest::test_sockoptfunction_ok
+    --deselect tests/user_agent_string_test.py::UserAgentStringTest::test_pycurl_user_agent_string
+    --ignore tests/write_test.py
+    --ignore tests/write_to_stringio_test.py
+    --deselect tests/xferinfo_cb_test.py::XferinfoCbTest::test_xferinfo_cb
+    # unclear failures
+    --deselect tests/multi_callback_test.py::MultiCallbackTest::test_multi_socket_action
+    --deselect tests/multi_socket_select_test.py::MultiSocketSelectTest::test_multi_socket_select
+  )
 
   cd pycurl-$pkgver
-  PYTHONPATH="$PWD/build/lib.linux-$CARCH-3.10:$PYTHONPATH" make test || warning "Tests failed"
+  python -m installer --destdir=test_dir dist/*.whl
+  export PYTHONPATH="$PWD/test_dir/$site_packages:$PYTHONPATH"
+  pytest "${pytest_options[@]}"
 }
 
 package() {
   cd pycurl-$pkgver
-  python setup.py install -O1 --root="$pkgdir"
+  python -m installer --destdir="$pkgdir" dist/*.whl
   install -Dm644 COPYING-MIT -t "$pkgdir"/usr/share/licenses/$pkgname/
 }