Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

test_script: Move Puppeteer downloads outside node_modules.

Anders Kaseorg0027d7dea758
diff --git a/requirements/dev.in b/requirements/dev.in
index a1255808b35..d8f4b87ee1e 100644
--- a/requirements/dev.in
+++ b/requirements/dev.in
@@ -78,3 +78,6 @@ natsort
# For spell check linter
codespell
+
+# Finds appropriate directories for data, config, cache, etc.
+platformdirs
diff --git a/requirements/dev.txt b/requirements/dev.txt
index 43da05ad758..a0d7c8b2779 100644
--- a/requirements/dev.txt
+++ b/requirements/dev.txt
@@ -1288,7 +1288,9 @@ pkgutil-resolve-name==1.3.10 \
platformdirs==2.5.2 \
--hash=sha256:027d8e83a2d7de06bbac4e5ef7e023c02b863d7ea5d079477e722bb41ab25788 \
--hash=sha256:58c8abb07dcb441e6ee4b11d8df0ac856038f944ab98b7be6b27b2a3c7feef19
- # via black
+ # via
+ # -r requirements/dev.in
+ # black
polib==1.1.1 \
--hash=sha256:d3ee85e0c6788f789353416b1612c6c92d75fe6ccfac0029711974d6abd0f86d \
--hash=sha256:e02c355ae5e054912e3b0d16febc56510eff7e49d60bf22aecb463bd2f2a2dfa
diff --git a/tools/lib/test_script.py b/tools/lib/test_script.py
index 08d7220dc0e..6f104564e6b 100644
--- a/tools/lib/test_script.py
+++ b/tools/lib/test_script.py
@@ -5,6 +5,8 @@ import sys
from argparse import ArgumentParser
from typing import Iterable, List, Optional, Tuple
+import platformdirs
+
from scripts.lib.zulip_tools import get_dev_uuid_var_path
from version import PROVISION_VERSION
@@ -120,6 +122,9 @@ def find_js_test_files(test_dir: str, files: Iterable[str]) -> List[str]:
def prepare_puppeteer_run(is_firefox: bool = False) -> None:
os.chdir(ZULIP_PATH)
+ download_path = platformdirs.user_cache_dir("zulip/puppeteer-download")
+ os.makedirs(download_path)
+ os.environ["PUPPETEER_DOWNLOAD_PATH"] = download_path
# This will determine if the browser will be firefox or chrome.
os.environ["PUPPETEER_PRODUCT"] = "firefox" if is_firefox else "chrome"
subprocess.check_call(["node", "node_modules/puppeteer/install.js"])