locust-cloud 1.26.4.dev12__tar.gz → 1.26.4.dev17__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of locust-cloud might be problematic. Click here for more details.

Files changed (37) hide show
  1. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/PKG-INFO +1 -1
  2. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/locust_cloud/__init__.py +13 -2
  3. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/locust_cloud/apisession.py +0 -2
  4. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/tests/browser_tests.py +8 -12
  5. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/.github/workflows/daily-check.yml +0 -0
  6. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/.github/workflows/tests.yml +0 -0
  7. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/.gitignore +0 -0
  8. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/.pre-commit-config.yaml +0 -0
  9. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/.vscode/extensions.json +0 -0
  10. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/.vscode/launch.json +0 -0
  11. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/.vscode/settings.json +0 -0
  12. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/LICENSE +0 -0
  13. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/README.md +0 -0
  14. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/locust_cloud/args.py +0 -0
  15. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/locust_cloud/common.py +0 -0
  16. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/locust_cloud/docs/.gitignore +0 -0
  17. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/locust_cloud/docs/1-first-run.rst +0 -0
  18. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/locust_cloud/docs/2-examples.rst +0 -0
  19. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/locust_cloud/docs/images/locust-cloud-screenshot.png +0 -0
  20. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/locust_cloud/docs/locust-cloud.rst +0 -0
  21. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/locust_cloud/import_finder.py +0 -0
  22. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/locust_cloud/input_events.py +0 -0
  23. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/locust_cloud/web_login.py +0 -0
  24. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/locust_cloud/websocket.py +0 -0
  25. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/locustfile.py +0 -0
  26. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/pyproject.toml +0 -0
  27. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/testdata/autodetected.py +0 -0
  28. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/testdata/extra-files/extra.txt +0 -0
  29. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/testdata/extra-package/example/__init__.py +0 -0
  30. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/testdata/extra-package/setup.py +0 -0
  31. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/testdata/requirements.txt +0 -0
  32. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/tests/args_test.py +0 -0
  33. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/tests/cloud_test.py +0 -0
  34. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/tests/import_finder_test.py +0 -0
  35. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/tests/web_login_test.py +0 -0
  36. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/tests/websocket_test.py +0 -0
  37. {locust_cloud-1.26.4.dev12 → locust_cloud-1.26.4.dev17}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: locust-cloud
3
- Version: 1.26.4.dev12
3
+ Version: 1.26.4.dev17
4
4
  Summary: Locust Cloud
5
5
  Project-URL: homepage, https://locust.cloud
6
6
  Project-URL: repository, https://github.com/locustcloud/locust-cloud
@@ -4,6 +4,7 @@ import pathlib
4
4
  import time
5
5
  import webbrowser
6
6
  from argparse import ArgumentTypeError
7
+ from datetime import timedelta
7
8
  from threading import Thread
8
9
 
9
10
  import requests
@@ -13,13 +14,22 @@ from locust_cloud.args import (
13
14
  valid_project_path,
14
15
  zip_project_paths,
15
16
  )
16
- from locust_cloud.common import __version__
17
+ from locust_cloud.common import CloudConfig, __version__, write_cloud_config
17
18
  from locust_cloud.import_finder import get_imported_files
18
19
  from locust_cloud.input_events import input_listener
19
20
  from locust_cloud.websocket import SessionMismatchError, Websocket, WebsocketTimeout
20
21
 
21
22
  logger = logging.getLogger(__name__)
22
23
 
24
+ if os.getenv("LOCUSTCLOUD_USER_SUB_ID") and os.getenv("LOCUSTCLOUD_REFRESH_TOKEN") and os.getenv("LOCUSTCLOUD_REGION"):
25
+ config = CloudConfig(
26
+ refresh_token=os.getenv("LOCUSTCLOUD_REFRESH_TOKEN"),
27
+ user_sub_id=os.getenv("LOCUSTCLOUD_USER_SUB_ID"),
28
+ refresh_token_expires=int(time.time() + timedelta(days=365).total_seconds()),
29
+ region=os.getenv("LOCUSTCLOUD_REGION"),
30
+ )
31
+ write_cloud_config(config)
32
+
23
33
 
24
34
  def configure_logging(loglevel: str) -> None:
25
35
  format = (
@@ -148,7 +158,8 @@ def main(locustfiles: list[str] | None = None):
148
158
  session_id = js["session_id"]
149
159
 
150
160
  def open_ui():
151
- webbrowser.open_new_tab("https://auth.locust.cloud/load-test")
161
+ extrasubdomain = ".dev." if "api-dev" in session.api_url else "."
162
+ webbrowser.open_new_tab(f"https://auth{extrasubdomain}locust.cloud/load-test")
152
163
 
153
164
  Thread(target=input_listener({"\r": open_ui, "\n": open_ui}), daemon=True).start()
154
165
 
@@ -59,8 +59,6 @@ class ApiSession(requests.Session):
59
59
  refresh_token = config.refresh_token
60
60
  id_token_expires = config.id_token_expires
61
61
 
62
- assert id_token
63
-
64
62
  self.__user_sub_id = user_sub_id
65
63
  self.__refresh_token = refresh_token
66
64
  self.__id_token_expires = id_token_expires - 60 # Refresh 1 minute before expiry
@@ -8,24 +8,20 @@ from playwright.sync_api import expect, sync_playwright
8
8
  HEADLESS = bool(os.environ.get("HEADLESS", False))
9
9
 
10
10
 
11
- def do_url_test(page, context):
11
+ def do_url_test(page, _context):
12
12
  # skip dashboard tutorial
13
13
  page.get_by_text("Skip").click()
14
- time.sleep(10)
14
+ time.sleep(5)
15
15
 
16
- with context.expect_page() as url_test_page_info:
17
- page.get_by_text("Run in Browser").click()
18
-
19
- url_test_page = url_test_page_info.value
20
- url_test_page.wait_for_load_state()
16
+ page.get_by_text("Run in Browser").click()
21
17
 
22
18
  # skip locust tutorial
23
- url_test_page.get_by_text("Skip").click()
19
+ page.get_by_text("Skip").click()
24
20
 
25
21
  # Select the mock target class for this test run
26
- url_test_page.get_by_text("Mock Target").click()
22
+ page.get_by_text("Mock Target").click()
27
23
 
28
- button = url_test_page.locator("button[type='submit']")
24
+ button = page.locator("button[type='submit']")
29
25
  expect(button).to_be_enabled(timeout=80000)
30
26
  button.click()
31
27
 
@@ -33,10 +29,10 @@ def do_url_test(page, context):
33
29
  time.sleep(20)
34
30
 
35
31
  # Stop the test
36
- url_test_page.get_by_text("Stop").click()
32
+ page.get_by_text("Stop").click()
37
33
 
38
34
  # Wait for the test to have stopped and the new button to appear
39
- button = url_test_page.locator('button:has-text("New")')
35
+ button = page.locator('button:has-text("New")')
40
36
  button.wait_for(state="visible", timeout=10000)
41
37
 
42
38