Use GitHub source to get tests; omit tox

The PyPi tarball doesn't have any tests in it, so this package isn't
really testing anything. Switch the source to the GitHub release to
download tests as part of the source.

Also use pytest for tests in place of tox since the tests work the same
way and we avoid tox dependencies going back into EPEL.

Add an import check in %check as well.

Signed-off-by: Major Hayden <major@redhat.com>
This commit is contained in:
Major Hayden 2023-06-28 16:48:52 -05:00
parent ed2b4702a6
commit 08e9535358
No known key found for this signature in database

View File

@ -6,15 +6,19 @@
Name: python-%{pypi_name} Name: python-%{pypi_name}
Version: 11.0.3 Version: 11.0.3
Release: 1%{?dist} Release: 2%{?dist}
Summary: Implementation of the WebSocket Protocol for Python Summary: Implementation of the WebSocket Protocol for Python
License: BSD License: BSD
URL: https://github.com/aaugustin/websockets URL: https://github.com/aaugustin/websockets
Source0: %pypi_source Source0: %{url}/archive/%{version}/%{pypi_name}-%{version}.tar.gz
BuildRequires: gcc BuildRequires: gcc
%if %{with tests}
BuildRequires: python3dist(pytest)
%endif
%global _description %{expand: %global _description %{expand:
websockets is a library for developing WebSocket servers and clients in websockets is a library for developing WebSocket servers and clients in
Python. It implements RFC 6455 with a focus on correctness and simplicity. It Python. It implements RFC 6455 with a focus on correctness and simplicity. It
@ -36,7 +40,7 @@ BuildRequires: python3-devel
%autosetup -n %{pypi_name}-%{version} -p1 %autosetup -n %{pypi_name}-%{version} -p1
%generate_buildrequires %generate_buildrequires
%pyproject_buildrequires %{?with_tests:-t} %pyproject_buildrequires
%build %build
%pyproject_wheel %pyproject_wheel
@ -46,8 +50,11 @@ BuildRequires: python3-devel
%pyproject_save_files websockets %pyproject_save_files websockets
%check %check
%pyproject_check_import
%if %{with tests} %if %{with tests}
%tox # Skip some tests that require network connectivity and/or a running daemon.
%pytest --ignore compliance --ignore tests/sync -k "not test_explicit_host_port"
%endif %endif
@ -55,6 +62,11 @@ BuildRequires: python3-devel
%doc README.rst %doc README.rst
%changelog %changelog
* Wed Jun 28 2023 Major Hayden <major@redhat.com> - 11.0.3-2
- Switch to GitHub source to get tests
- Replace tox with pytest
- Add pyproject_check_import
* Wed Jun 28 2023 Major Hayden <major@redhat.com> - 11.0.3-1 * Wed Jun 28 2023 Major Hayden <major@redhat.com> - 11.0.3-1
- Update to 11.0.3 - Update to 11.0.3