#! /usr/bin/make -f include /usr/share/dpkg/architecture.mk include /usr/share/dpkg/pkg-info.mk export PYBUILD_NAME=locust export SETUPTOOLS_SCM_PRETEND_VERSION=$(DEB_VERSION_UPSTREAM) # tests excluded from the build and the autopkgtest: # test_stuff, test_verify_false_succeeds_with_bad_cert, # test_verify_true_fails_with_bad_cert, test_locustfile_from_url - need # network access # test_constructor - expects localhost to also resolve to an IPv6 address, # which is not the case on every builder # test_default_wait_time - timing sensitive, flaky on loaded builders # test_client_pool_concurrency, test_stop_timeout_with_interrupt_no_reschedule # - allow 0.1 s and 0.01 s over the time their requests or tasks take, # which a loaded amd64 builder also misses # StandaloneIntegrationTests, DistributedIntegrationTests, TelemetryTests - # start locust processes and stop them with SIGINT, which fails at random # even on amd64: the KeyboardInterrupt lands in whatever greenlet runs, and # some swallow it, leaving the master running and its --processes workers # joining the masters of the following tests, while others print it as a # traceback the tests look for # --deselect matches node id prefixes: the trailing :: keeps a class from # also matching the classes whose name starts with it; a test name can't be # ended that way, so test_constant_throughput below also deselects the # argument check test_constant_throughput_invalid_rate PYTEST_ARGS = -v -k 'not test_stuff and not test_verify_false_succeeds_with_bad_cert \ and not test_verify_true_fails_with_bad_cert and not test_locustfile_from_url \ and not test_constructor and not test_default_wait_time' \ --deselect locust/test/test_main.py::StandaloneIntegrationTests:: \ --deselect locust/test/test_main.py::DistributedIntegrationTests:: \ --deselect locust/test/test_main.py::TelemetryTests:: \ --deselect locust/test/test_fasthttp.py::TestFastHttpUserClass::test_client_pool_concurrency \ --deselect locust/test/test_runners.py::TestStopTimeout::test_stop_timeout_with_interrupt_no_reschedule # tests with fixed timeouts, sleeps, short intervals, elapsed time tolerances # or that race the wall clock, excluded from the autopkgtest except on amd64 # and i386: they keep failing on the slower or loaded armhf, riscv64, arm64, # ppc64el and s390x workers. The files holding most of them go as a whole, so # new tests there need no entry. The build, arch all, always runs them. ifdef PYBUILD_AUTOPKGTEST ifeq (,$(filter $(DEB_HOST_ARCH),amd64 i386)) PYTEST_ARGS += \ --ignore=locust/test/test_debugging.py \ --ignore=locust/test/test_dispatch.py \ --ignore=locust/test/test_log.py \ --ignore=locust/test/test_runners.py \ --ignore=locust/test/test_stats.py \ --ignore=locust/test/test_web.py \ --ignore=locust/test/test_zmqrpc.py \ --deselect locust/test/test_fasthttp.py::TestFastHttpSession::test_error_message_with_name_replacement \ --deselect locust/test/test_fasthttp.py::TestFastHttpSession::test_streaming_response \ --deselect locust/test/test_fasthttp.py::TestFastHttpSession::test_streaming_response_catch_response \ --deselect locust/test/test_fasthttp.py::TestFastHttpUserClass::test_network_timeout_setting \ --deselect locust/test/test_http.py::TestHttpSession::test_catch_response_timeout \ --deselect locust/test/test_http.py::TestHttpSession::test_error_message_with_name_replacement \ --deselect locust/test/test_http.py::TestHttpSession::test_event_measure \ --deselect locust/test/test_http.py::TestHttpSession::test_streaming_response \ --deselect locust/test/test_locust_class.py::TestLocustClass::test_locust_graceful_stop \ --deselect locust/test/test_locust_class.py::TestLocustClass::test_locust_start \ --deselect locust/test/test_locust_class.py::TestTaskSet::test_on_stop_when_locust_stops \ --deselect locust/test/test_wait_time.py::TestWaitTime::test_constant_throughput endif endif # the tests are not installed: run them from symlinks to the installed # package, with locust/test copied next to them; every interpreter gets the # same {build_dir}, so the tree of the previous one is removed first ifdef PYBUILD_AUTOPKGTEST # empty, not unset: pybuild would set them to a dead proxy, which also # catches the requests the tests make to 127.0.0.1 export http_proxy = export https_proxy = export PYBUILD_BEFORE_TEST = rm -rf {build_dir}/locust && mkdir -p {build_dir} && cp -as /usr/lib/python3/dist-packages/locust {build_dir}/ && cp -a {dir}/locust/test {build_dir}/locust/ export PYBUILD_TEST_ARGS = $(PYTEST_ARGS) locust/test endif %: dh $@ --buildsystem=pybuild execute_before_dh_auto_build: # prebuilt web UI from the webui component tarball cp -a webui/locust/webui/dist locust/webui/ python3 debian/remove-azure-ad.py locust/webui/dist/assets/src-*.js override_dh_auto_test: http_proxy= https_proxy= PATH=$(PATH):$(CURDIR)/debian PYBUILD_SYSTEM=custom PYBUILD_TEST_ARGS="PYTHONPATH={build_dir} {interpreter} -m pytest $(PYTEST_ARGS)" dh_auto_test execute_before_dh_installman: # COLUMNS keeps argparse from wrapping the help text, and the URLs in it; # the package is still in the versioned dist-packages before dh_python3 COLUMNS=1000 PYTHONPATH=$(CURDIR)/debian/python3-locust/usr/lib/python$(shell py3versions -dv)/dist-packages \ help2man --no-info --version-string=$(DEB_VERSION_UPSTREAM) \ --name="developer-friendly load testing framework" \ --output=debian/locust.1 debian/python3-locust/usr/bin/locust override_dh_installexamples: dh_installexamples -X.pyc override_dh_clean: rm -rf locust/_version.py locust/webui/dist web_test_*.csv locust_output.json debian/locust.1 dh_clean