gnu: python-locust: Update to 2.32.5.

* gnu/packages/benchmark.scm (python-locust): Update to 2.32.5.
[source]: Get from git repository.
[build-system]: Use pyproject-build-system.
[arguments]: Update list of disabled tests; remove custom 'check phase; add
phase 'fix-version.
[propagated-inputs]: Remove python-flask-basicauth and python-roundrobin; add
python-flask-login, python-setuptools, and python-tomli.
[native-inputs]: Add nss-certs-for-test, python-poetry-core,
and python-poetry-dynamic-versioning; remove python-mock and
python-setuptools-scm.

Change-Id: I5e7203d48eda9279531c9d3060d81d91974dee6e
This commit is contained in:
Ricardo Wurmus 2025-01-07 16:04:10 +01:00
parent b70ac4564c
commit c09fc8696d
No known key found for this signature in database
GPG key ID: 197A5888235FACAC

View file

@ -2,7 +2,7 @@
;;; Copyright © 2016, 2017, 2021 Marius Bakke <marius@gnu.org> ;;; Copyright © 2016, 2017, 2021 Marius Bakke <marius@gnu.org>
;;; Copyright © 2017 Dave Love <fx@gnu.org> ;;; Copyright © 2017 Dave Love <fx@gnu.org>
;;; Copyright © 20182022 Tobias Geerinckx-Rice <me@tobias.gr> ;;; Copyright © 20182022 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@elephly.net> ;;; Copyright © 2018, 2019, 2025 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2019 Eric Bavier <bavier@member.fsf.org> ;;; Copyright © 2019 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2019 Gábor Boskovits <boskovits@gmail.com> ;;; Copyright © 2019 Gábor Boskovits <boskovits@gmail.com>
;;; Copyright © 2019, 2021 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2019, 2021 Ludovic Courtès <ludo@gnu.org>
@ -34,17 +34,20 @@
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix download) #:use-module (guix download)
#:use-module (guix gexp) #:use-module (guix gexp)
#:use-module (guix utils)
#:use-module (guix git-download) #:use-module (guix git-download)
#:use-module (guix search-paths) #:use-module (guix search-paths)
#:use-module (guix build-system cmake) #:use-module (guix build-system cmake)
#:use-module (guix build-system gnu) #:use-module (guix build-system gnu)
#:use-module (guix build-system python) #:use-module (guix build-system python)
#:use-module (guix build-system pyproject)
#:use-module (guix build-system meson) #:use-module (guix build-system meson)
#:use-module (gnu packages) #:use-module (gnu packages)
#:use-module (gnu packages autotools) #:use-module (gnu packages autotools)
#:use-module (gnu packages base) #:use-module (gnu packages base)
#:use-module (gnu packages bash) #:use-module (gnu packages bash)
#:use-module (gnu packages c) #:use-module (gnu packages c)
#:use-module (gnu packages certs)
#:use-module (gnu packages check) #:use-module (gnu packages check)
#:use-module (gnu packages compression) #:use-module (gnu packages compression)
#:use-module (gnu packages databases) #:use-module (gnu packages databases)
@ -399,86 +402,155 @@ setup against another one.")
(define-public python-locust (define-public python-locust
(package (package
(name "python-locust") (name "python-locust")
(version "2.15.1") (version "2.32.5")
(source ;; The archive on Pypi has no tests.
(origin (source (origin
(method url-fetch) (method git-fetch)
(uri (pypi-uri "locust" version)) (uri (git-reference
(sha256 (url "https://github.com/locustio/locust")
(base32 (commit version)))
"05cznfqda0yq2j351jjdssayvj5qc11xkbkwdvv81hcmz4xpyc56")))) (file-name (git-file-name name version))
(build-system python-build-system) (sha256
(base32
"0nmhk2k0mbza9slqgms42s6hsfwwmyr275l90an02qaypx066l1n"))))
(build-system pyproject-build-system)
(arguments (arguments
'(#:phases (list
(modify-phases %standard-phases #:test-flags
(add-before 'check 'increase-resource-limits '(list "--pyargs" "locust/test"
(lambda _ "-k" (string-join
;; XXX: Copied from ungoogled-chromium. '( ;; These tests return "non-zero exit status 1".
;; Try increasing the soft resource limit of max open files to 2048, "not test_default_headless_spawn_options"
;; or equal to the hard limit, whichever is lower. "not test_default_headless_spawn_options_with_shape"
(call-with-values (lambda () (getrlimit 'nofile)) "not test_headless_spawn_options_wo_run_time"
(lambda (soft hard) ;; Fails because of timezone discrepancy, even when TZDIR
(when (and soft (< soft 2048)) ;; is set.
(if hard "not test_format_utc_timestamp"
(setrlimit 'nofile (min hard 2048) hard) ;; These tests fail with a HTTP return code of
(setrlimit 'nofile 2048 #f)) ;; 500 instead of 200, for unknown reasons.
(format #t "not test_autostart_mutliple_locustfiles_with_shape"
"increased maximum number of open files from ~d to ~d~%" "not test_autostart_w_load_shape"
soft (if hard (min hard 2048) 2048))))))) "not test_autostart_wo_run_time"
(replace 'check "not test_percentile_parameter"
(lambda* (#:key tests? #:allow-other-keys) "not test_percentiles_to_statistics"
(when tests? "not test_autostart_multiple_locustfiles_with_shape"
(invoke "python" "-m" "pytest" "locust" "not test_graceful_exit_when_keyboard_interrupt"
"-k" (string-join "not test_host_value_from_multiple_user_classes"
'( ;; These tests return "non-zero exit status 1". "not test_host_value_from_multiple_user_classes_different_hosts"
"not test_default_headless_spawn_options" "not test_host_value_from_user_class"
"not test_default_headless_spawn_options_with_shape" "not test_html_stats_report"
"not test_headless_spawn_options_wo_run_time" "not test_index"
;; These tests fail with a HTTP return code of "not test_index_with_spawn_options"
;; 500 instead of 200, for unknown reasons. "not test_report_download"
"not test_autostart_mutliple_locustfiles_with_shape" "not test_report_exceptions"
"not test_autostart_w_load_shape" "not test_report_host"
"not test_autostart_wo_run_time" "not test_report_host2"
"not test_percentile_parameter" "not test_report_page"
;; These tests depend on networking. "not test_report_page_empty_stats"
"not test_html_report_option" "not test_index_with_web_login_enabled_no_user"
"not test_json_schema" "not test_index_with_web_login_enabled_valid_user"
"not test_web_options" "not test_index_with_https"
;; These tests fail because of the warning "not test_ssl_request_insecure"
;; "System open file limit '1024' is below ;; Fails because of unavailable IPv6
;; minimum setting '10000'". "not test_constructor"
"not test_autostart_w_run_time" ;; Process fails to terminate, which breaks following tests
"not test_skip_logging" "not test_processes_ctrl_c"
;; On some (slow?) machines, the following tests ;; These tests depend on networking.
;; fail, with the processes returning exit code "not test_html_report_option"
;; -15 instead of the expected 42 and 0, "not test_json_schema"
;; respectively (see: "not test_locustfile_from_url"
;; https://github.com/locustio/locust/issues/1708). "not test_web_options"
"not test_custom_exit_code" ;; These tests fail because of the warning
"not test_webserver" ;; "System open file limit '1024' is below
;; This test fails with "AssertionError: ;; minimum setting '10000'".
;; 'stopped' != 'stopping'". "not test_autostart_w_run_time"
"not test_distributed_shape") " and ")))))))) "not test_skip_logging"
;; On some (slow?) machines, the following tests
;; fail, with the processes returning exit code
;; -15 instead of the expected 42 and 0,
;; respectively (see:
;; https://github.com/locustio/locust/issues/1708).
"not test_custom_exit_code"
"not test_webserver"
;; These are time critical and can fail on busy machines.
"not test_distribute_users"
"not test_ramp_down_from_100_000_to_0_users_with_50_user_classes_and_1000_workers_and_5000_spawn_rate"
"not test_ramp_up_from_0_to_100_000_users_with_50_user_classes_and_1000_workers_and_5000_spawn_rate"
;; This test fails with "AssertionError:
;; 'stopped' != 'stopping'".
"not test_distributed_shape") " and "))
#:phases
#~(modify-phases %standard-phases
;; The build system attempts to detect the version by spawning git.
(add-after 'unpack 'fix-version
(lambda _
(let ((tuple (list
#$@(match (string-split (version-major+minor+point version) #\.)
((ma mi po) (list ma mi po))))))
(with-output-to-file "locust/_version.py"
(lambda _
(display (string-append "\
VERSION_TUPLE = object
TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import Tuple, Union
VERSION_TUPLE = Tuple[Union[int, str], ...]
else:
VERSION_TUPLE = object
version: str
__version__: str
__version_tuple__: VERSION_TUPLE
version_tuple: VERSION_TUPLE
__version__ = \"" #$version "\"
version = __version__
__version_tuple__ = (" (car tuple) ", " (cadr tuple) ", " (caddr tuple) ")
version_tuple = __version_tuple__
")))))
(substitute* "pyproject.toml"
(("setuptools = \">=70.0.0\"") "setuptools = \">=67.0.0\"")
(("^version =.*") (string-append "version = \"" #$version "\"\n"))
(("enable = true") "enable = false"))))
(add-before 'check 'increase-resource-limits
(lambda _
;; XXX: Copied from ungoogled-chromium.
;; Try increasing the soft resource limit of max open files to 2048,
;; or equal to the hard limit, whichever is lower.
(call-with-values (lambda () (getrlimit 'nofile))
(lambda (soft hard)
(when (and soft (< soft 2048))
(if hard
(setrlimit 'nofile (min hard 2048) hard)
(setrlimit 'nofile 2048 #f))
(format #t
"increased maximum number of open files from ~d to ~d~%"
soft (if hard (min hard 2048) 2048))))))))))
(propagated-inputs (propagated-inputs
(list python-configargparse (list python-configargparse
python-flask python-flask
python-flask-basicauth
python-flask-cors python-flask-cors
python-flask-login
python-gevent python-gevent
python-geventhttpclient python-geventhttpclient
python-msgpack python-msgpack
python-psutil python-psutil
python-pyzmq python-pyzmq
python-requests python-requests
python-roundrobin python-setuptools
python-tomli
python-typing-extensions python-typing-extensions
python-werkzeug)) python-werkzeug))
(native-inputs (native-inputs
(list python-mock (list nss-certs-for-test
python-poetry-core
python-poetry-dynamic-versioning
python-pyquery python-pyquery
python-pytest python-pytest
python-retry python-retry))
python-setuptools-scm))
(home-page "https://locust.io/") (home-page "https://locust.io/")
(synopsis "Distributed load testing framework") (synopsis "Distributed load testing framework")
(description "Locust is a performance testing tool that aims to be easy to (description "Locust is a performance testing tool that aims to be easy to