fastled 1.2.47__tar.gz → 1.2.49__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.
Files changed (116) hide show
  1. {fastled-1.2.47 → fastled-1.2.49}/PKG-INFO +1 -1
  2. {fastled-1.2.47 → fastled-1.2.49}/lint +1 -4
  3. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/__init__.py +1 -1
  4. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/client_server.py +6 -2
  5. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/docker_manager.py +49 -17
  6. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/filewatcher.py +16 -4
  7. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/web_compile.py +2 -1
  8. {fastled-1.2.47 → fastled-1.2.49}/src/fastled.egg-info/PKG-INFO +1 -1
  9. {fastled-1.2.47 → fastled-1.2.49}/tests/test_http_server.py +4 -1
  10. {fastled-1.2.47 → fastled-1.2.49}/.aiderignore +0 -0
  11. {fastled-1.2.47 → fastled-1.2.49}/.dockerignore +0 -0
  12. {fastled-1.2.47 → fastled-1.2.49}/.github/workflows/build_multi_docker_image.yml +0 -0
  13. {fastled-1.2.47 → fastled-1.2.49}/.github/workflows/build_webpage.yml +0 -0
  14. {fastled-1.2.47 → fastled-1.2.49}/.github/workflows/lint.yml +0 -0
  15. {fastled-1.2.47 → fastled-1.2.49}/.github/workflows/publish_release.yml +0 -0
  16. {fastled-1.2.47 → fastled-1.2.49}/.github/workflows/template_build_docker_image.yml +0 -0
  17. {fastled-1.2.47 → fastled-1.2.49}/.github/workflows/test_build_exe.yml +0 -0
  18. {fastled-1.2.47 → fastled-1.2.49}/.github/workflows/test_macos.yml +0 -0
  19. {fastled-1.2.47 → fastled-1.2.49}/.github/workflows/test_ubuntu.yml +0 -0
  20. {fastled-1.2.47 → fastled-1.2.49}/.github/workflows/test_win.yml +0 -0
  21. {fastled-1.2.47 → fastled-1.2.49}/.gitignore +0 -0
  22. {fastled-1.2.47 → fastled-1.2.49}/.pylintrc +0 -0
  23. {fastled-1.2.47 → fastled-1.2.49}/.vscode/launch.json +0 -0
  24. {fastled-1.2.47 → fastled-1.2.49}/.vscode/settings.json +0 -0
  25. {fastled-1.2.47 → fastled-1.2.49}/.vscode/tasks.json +0 -0
  26. {fastled-1.2.47 → fastled-1.2.49}/Dockerfile +0 -0
  27. {fastled-1.2.47 → fastled-1.2.49}/LICENSE +0 -0
  28. {fastled-1.2.47 → fastled-1.2.49}/MANIFEST.in +0 -0
  29. {fastled-1.2.47 → fastled-1.2.49}/README.md +0 -0
  30. {fastled-1.2.47 → fastled-1.2.49}/RELEASE.md +0 -0
  31. {fastled-1.2.47 → fastled-1.2.49}/TODO.md +0 -0
  32. {fastled-1.2.47 → fastled-1.2.49}/build_exe.py +0 -0
  33. {fastled-1.2.47 → fastled-1.2.49}/build_site.py +0 -0
  34. {fastled-1.2.47 → fastled-1.2.49}/clean +0 -0
  35. {fastled-1.2.47 → fastled-1.2.49}/compiler/CMakeLists.txt +0 -0
  36. {fastled-1.2.47 → fastled-1.2.49}/compiler/__init__.py +0 -0
  37. {fastled-1.2.47 → fastled-1.2.49}/compiler/arduino-pre-process.sh +0 -0
  38. {fastled-1.2.47 → fastled-1.2.49}/compiler/build.sh +0 -0
  39. {fastled-1.2.47 → fastled-1.2.49}/compiler/build_archive.sh +0 -0
  40. {fastled-1.2.47 → fastled-1.2.49}/compiler/build_fast.sh +0 -0
  41. {fastled-1.2.47 → fastled-1.2.49}/compiler/code_sync.py +0 -0
  42. {fastled-1.2.47 → fastled-1.2.49}/compiler/compile.py +0 -0
  43. {fastled-1.2.47 → fastled-1.2.49}/compiler/compile_lock.py +0 -0
  44. {fastled-1.2.47 → fastled-1.2.49}/compiler/entrypoint.sh +0 -0
  45. {fastled-1.2.47 → fastled-1.2.49}/compiler/extra/100dots.html +0 -0
  46. {fastled-1.2.47 → fastled-1.2.49}/compiler/extra/demo_threejs.html +0 -0
  47. {fastled-1.2.47 → fastled-1.2.49}/compiler/extra/webgl_postprocessing_unreal_bloom.html +0 -0
  48. {fastled-1.2.47 → fastled-1.2.49}/compiler/final_prewarm.sh +0 -0
  49. {fastled-1.2.47 → fastled-1.2.49}/compiler/init_runtime.py +0 -0
  50. {fastled-1.2.47 → fastled-1.2.49}/compiler/install-arduino-cli.sh +0 -0
  51. {fastled-1.2.47 → fastled-1.2.49}/compiler/libcompile/CMakeLists.txt +0 -0
  52. {fastled-1.2.47 → fastled-1.2.49}/compiler/paths.py +0 -0
  53. {fastled-1.2.47 → fastled-1.2.49}/compiler/pre-process.sh +0 -0
  54. {fastled-1.2.47 → fastled-1.2.49}/compiler/prewarm.sh +0 -0
  55. {fastled-1.2.47 → fastled-1.2.49}/compiler/process-ino.py +0 -0
  56. {fastled-1.2.47 → fastled-1.2.49}/compiler/requirements.txt +0 -0
  57. {fastled-1.2.47 → fastled-1.2.49}/compiler/run.py +0 -0
  58. {fastled-1.2.47 → fastled-1.2.49}/compiler/server.py +0 -0
  59. {fastled-1.2.47 → fastled-1.2.49}/compiler/sketch_hasher.py +0 -0
  60. {fastled-1.2.47 → fastled-1.2.49}/compiler/wasm_compiler_flags.py +0 -0
  61. {fastled-1.2.47 → fastled-1.2.49}/docker-compose.yml +0 -0
  62. {fastled-1.2.47 → fastled-1.2.49}/install +0 -0
  63. {fastled-1.2.47 → fastled-1.2.49}/install_linux.sh +0 -0
  64. {fastled-1.2.47 → fastled-1.2.49}/pyproject.toml +0 -0
  65. {fastled-1.2.47 → fastled-1.2.49}/requirements.testing.txt +0 -0
  66. {fastled-1.2.47 → fastled-1.2.49}/setup.cfg +0 -0
  67. {fastled-1.2.47 → fastled-1.2.49}/setup.py +0 -0
  68. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/app.py +0 -0
  69. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/assets/example.txt +0 -0
  70. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/cli.py +0 -0
  71. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/compile_server.py +0 -0
  72. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/compile_server_impl.py +0 -0
  73. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/interactive_srcs.py +0 -0
  74. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/keyboard.py +0 -0
  75. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/live_client.py +0 -0
  76. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/open_browser.py +0 -0
  77. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/open_browser2.py +0 -0
  78. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/parse_args.py +0 -0
  79. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/paths.py +0 -0
  80. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/project_init.py +0 -0
  81. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/select_sketch_directory.py +0 -0
  82. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/settings.py +0 -0
  83. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/site/build.py +0 -0
  84. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/sketch.py +0 -0
  85. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/spinner.py +0 -0
  86. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/string_diff.py +0 -0
  87. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/test/can_run_local_docker_tests.py +0 -0
  88. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/test/examples.py +0 -0
  89. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/types.py +0 -0
  90. {fastled-1.2.47 → fastled-1.2.49}/src/fastled/util.py +0 -0
  91. {fastled-1.2.47 → fastled-1.2.49}/src/fastled.egg-info/SOURCES.txt +0 -0
  92. {fastled-1.2.47 → fastled-1.2.49}/src/fastled.egg-info/dependency_links.txt +0 -0
  93. {fastled-1.2.47 → fastled-1.2.49}/src/fastled.egg-info/entry_points.txt +0 -0
  94. {fastled-1.2.47 → fastled-1.2.49}/src/fastled.egg-info/requires.txt +0 -0
  95. {fastled-1.2.47 → fastled-1.2.49}/src/fastled.egg-info/top_level.txt +0 -0
  96. {fastled-1.2.47 → fastled-1.2.49}/test +0 -0
  97. {fastled-1.2.47 → fastled-1.2.49}/tests/html/index.html +0 -0
  98. {fastled-1.2.47 → fastled-1.2.49}/tests/test_api.py +0 -0
  99. {fastled-1.2.47 → fastled-1.2.49}/tests/test_bad_ino.py +0 -0
  100. {fastled-1.2.47 → fastled-1.2.49}/tests/test_build_examples.py +0 -0
  101. {fastled-1.2.47 → fastled-1.2.49}/tests/test_cli.py +0 -0
  102. {fastled-1.2.47 → fastled-1.2.49}/tests/test_compile_server.py +0 -0
  103. {fastled-1.2.47 → fastled-1.2.49}/tests/test_docker_linux_on_windows.py +0 -0
  104. {fastled-1.2.47 → fastled-1.2.49}/tests/test_embedded_data.py +0 -0
  105. {fastled-1.2.47 → fastled-1.2.49}/tests/test_examples.py +0 -0
  106. {fastled-1.2.47 → fastled-1.2.49}/tests/test_filechanger.py +0 -0
  107. {fastled-1.2.47 → fastled-1.2.49}/tests/test_ino/bad/bad.ino +0 -0
  108. {fastled-1.2.47 → fastled-1.2.49}/tests/test_ino/bad_platformio/bad_platformio.ino +0 -0
  109. {fastled-1.2.47 → fastled-1.2.49}/tests/test_ino/bad_platformio/platformio.ini +0 -0
  110. {fastled-1.2.47 → fastled-1.2.49}/tests/test_ino/embedded/data/bigdata.dat +0 -0
  111. {fastled-1.2.47 → fastled-1.2.49}/tests/test_ino/embedded/wasm.ino +0 -0
  112. {fastled-1.2.47 → fastled-1.2.49}/tests/test_ino/wasm/wasm.ino +0 -0
  113. {fastled-1.2.47 → fastled-1.2.49}/tests/test_project_init.py +0 -0
  114. {fastled-1.2.47 → fastled-1.2.49}/tests/test_server_and_client_seperatly.py +0 -0
  115. {fastled-1.2.47 → fastled-1.2.49}/tests/test_webcompile.py +0 -0
  116. {fastled-1.2.47 → fastled-1.2.49}/upload_package.sh +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: fastled
3
- Version: 1.2.47
3
+ Version: 1.2.49
4
4
  Summary: FastLED Wasm Compiler
5
5
  Home-page: https://github.com/zackees/fastled-wasm
6
6
  Maintainer: Zachary Vorhies
@@ -14,9 +14,6 @@ isort --profile black src tests compiler
14
14
  echo Running mypy src compiler
15
15
  mypy src tests compiler
16
16
  echo Running pyright src tests compiler
17
- #pyright src tests compiler
18
- # pyright src # later
19
- # pyright tests # later
20
- pyright compiler
17
+ pyright src compiler tests
21
18
  echo Linting complete!
22
19
  exit 0
@@ -13,7 +13,7 @@ from .types import BuildMode, CompileResult, CompileServerError
13
13
  # IMPORTANT! There's a bug in github which will REJECT any version update
14
14
  # that has any other change in the repo. Please bump the version as the
15
15
  # ONLY change in a commit, or else the pypi update and the release will fail.
16
- __version__ = "1.2.47"
16
+ __version__ = "1.2.49"
17
17
 
18
18
  DOCKER_FILE = (
19
19
  "https://raw.githubusercontent.com/zackees/fastled-wasm/refs/heads/main/Dockerfile"
@@ -230,13 +230,17 @@ def run_client(
230
230
  print("\nExiting from main")
231
231
  return 1
232
232
 
233
- sketch_filewatcher = FileWatcherProcess(directory, excluded_patterns=["fastled_js"])
233
+ excluded_patterns = ["fastled_js"]
234
+
235
+ sketch_filewatcher = FileWatcherProcess(
236
+ directory, excluded_patterns=excluded_patterns
237
+ )
234
238
 
235
239
  source_code_watcher: FileWatcherProcess | None = None
236
240
  if compile_server and compile_server.using_fastled_src_dir_volume():
237
241
  assert compile_server.fastled_src_dir is not None
238
242
  source_code_watcher = FileWatcherProcess(
239
- compile_server.fastled_src_dir, excluded_patterns=[]
243
+ compile_server.fastled_src_dir, excluded_patterns=excluded_patterns
240
244
  )
241
245
 
242
246
  def trigger_rebuild_if_sketch_changed(
@@ -18,7 +18,7 @@ import docker
18
18
  from appdirs import user_data_dir
19
19
  from disklru import DiskLRUCache
20
20
  from docker.client import DockerClient
21
- from docker.errors import DockerException, NotFound
21
+ from docker.errors import DockerException, ImageNotFound, NotFound
22
22
  from docker.models.containers import Container
23
23
  from docker.models.images import Image
24
24
  from filelock import FileLock
@@ -98,6 +98,11 @@ class RunningContainer:
98
98
  self.running = False
99
99
  self.thread.join()
100
100
 
101
+ def stop(self) -> None:
102
+ """Stop the container"""
103
+ self.container.stop()
104
+ self.detach()
105
+
101
106
 
102
107
  class DockerManager:
103
108
  def __init__(self) -> None:
@@ -316,11 +321,12 @@ class DockerManager:
316
321
  subprocess.run(cmd_list, check=True)
317
322
  print(f"Updated to newer version of {image_name}:{tag}")
318
323
  local_image_hash = self.client.images.get(f"{image_name}:{tag}").id
324
+ assert local_image_hash is not None
319
325
  if remote_image_hash is not None:
320
326
  DISK_CACHE.put(local_image_hash, remote_image_hash)
321
327
  return True
322
328
 
323
- except docker.errors.ImageNotFound:
329
+ except ImageNotFound:
324
330
  print(f"Image {image_name}:{tag} not found.")
325
331
  with Spinner("Loading "):
326
332
  # We use docker cli here because it shows the download.
@@ -332,7 +338,7 @@ class DockerManager:
332
338
  local_image = self.client.images.get(f"{image_name}:{tag}")
333
339
  local_image_hash = local_image.id
334
340
  print(f"Image {image_name}:{tag} downloaded successfully.")
335
- except docker.errors.ImageNotFound:
341
+ except ImageNotFound:
336
342
  warnings.warn(f"Image {image_name}:{tag} not found after download.")
337
343
  return True
338
344
 
@@ -354,8 +360,11 @@ class DockerManager:
354
360
  """Compare if existing container has matching configuration"""
355
361
  try:
356
362
  # Check if container is using the same image
357
- container_image_id = container.image.id
358
- container_image_tags = container.image.tags
363
+ image = container.image
364
+ assert image is not None
365
+ container_image_id = image.id
366
+ container_image_tags = image.tags
367
+ assert container_image_id is not None
359
368
 
360
369
  # Simplified image comparison - just compare the IDs directly
361
370
  if not container_image_tags:
@@ -421,7 +430,7 @@ class DockerManager:
421
430
  return False
422
431
  except KeyboardInterrupt:
423
432
  raise
424
- except docker.errors.NotFound:
433
+ except NotFound:
425
434
  print("Container not found.")
426
435
  return False
427
436
  except Exception as e:
@@ -502,13 +511,13 @@ class DockerManager:
502
511
  print(out_msg)
503
512
  print("#" * msg_len + "\n")
504
513
  container = self.client.containers.run(
505
- image_name,
506
- command,
514
+ image=image_name,
515
+ command=command,
507
516
  name=container_name,
508
517
  detach=True,
509
518
  tty=True,
510
519
  volumes=volumes,
511
- ports=ports,
520
+ ports=ports, # type: ignore
512
521
  remove=True,
513
522
  )
514
523
  return container
@@ -563,7 +572,10 @@ class DockerManager:
563
572
  Returns a RunningContainer object that can be used to stop monitoring.
564
573
  """
565
574
  if isinstance(container, str):
566
- container = self.get_container(container)
575
+ container_name = container
576
+ tmp = self.get_container(container)
577
+ assert tmp is not None, f"Container {container_name} not found."
578
+ container = tmp
567
579
 
568
580
  assert container is not None, "Container not found."
569
581
 
@@ -580,10 +592,13 @@ class DockerManager:
580
592
  """
581
593
  if isinstance(container, str):
582
594
  container_name = container
583
- container = self.get_container(container)
584
- if not container:
595
+ # container = self.get_container(container)
596
+ tmp = self.get_container(container_name)
597
+ if not tmp:
585
598
  print(f"Could not put container {container_name} to sleep.")
586
599
  return
600
+ container = tmp
601
+ assert isinstance(container, Container)
587
602
  try:
588
603
  if platform.system() == "Windows":
589
604
  container.pause()
@@ -600,16 +615,27 @@ class DockerManager:
600
615
  """
601
616
  Resume (unpause) the container.
602
617
  """
618
+ container_name = "UNKNOWN"
603
619
  if isinstance(container, str):
604
- container = self.get_container(container)
620
+ container_name = container
621
+ container_or_none = self.get_container(container)
622
+ if container_or_none is None:
623
+ print(f"Could not resume container {container}.")
624
+ return
625
+ container = container_or_none
626
+ container_name = container.name
627
+ elif isinstance(container, Container):
628
+ container_name = container.name
629
+ assert isinstance(container, Container)
605
630
  if not container:
606
631
  print(f"Could not resume container {container}.")
607
632
  return
608
633
  try:
634
+ assert isinstance(container, Container)
609
635
  container.unpause()
610
636
  print(f"Container {container.name} has been resumed.")
611
637
  except Exception as e:
612
- print(f"Failed to resume container {container.name}: {e}")
638
+ print(f"Failed to resume container {container_name}: {e}")
613
639
 
614
640
  def get_container(self, container_name: str) -> Container | None:
615
641
  """
@@ -753,6 +779,7 @@ def main():
753
779
  # new_tag = "my-python"
754
780
  container_name = "my-python-container"
755
781
  command = "python -m http.server"
782
+ running_container: RunningContainer | None = None
756
783
 
757
784
  try:
758
785
  # Step 1: Validate or download the image
@@ -775,13 +802,18 @@ def main():
775
802
 
776
803
  except KeyboardInterrupt:
777
804
  print("\nStopping container...")
778
- running_container.stop()
779
- container = docker_manager.get_container(container_name)
780
- docker_manager.suspend_container(container)
805
+ if isinstance(running_container, RunningContainer):
806
+ running_container.stop()
807
+ container_or_none = docker_manager.get_container(container_name)
808
+ if container_or_none is not None:
809
+ docker_manager.suspend_container(container_or_none)
810
+ else:
811
+ warnings.warn(f"Container {container_name} not found.")
781
812
 
782
813
  try:
783
814
  # Suspend and resume the container
784
815
  container = docker_manager.get_container(container_name)
816
+ assert container is not None, "Container not found."
785
817
  docker_manager.suspend_container(container)
786
818
 
787
819
  input("Press Enter to resume the container...")
@@ -15,6 +15,8 @@ from watchdog.events import FileSystemEvent, FileSystemEventHandler
15
15
  from watchdog.observers import Observer
16
16
  from watchdog.observers.api import BaseObserver
17
17
 
18
+ _WATCHER_TIMEOUT = 0.1
19
+
18
20
 
19
21
  def file_watcher_enabled() -> bool:
20
22
  """Check if watchdog is disabled"""
@@ -120,7 +122,7 @@ class FileChangedNotifier(threading.Thread):
120
122
  finally:
121
123
  self.stop()
122
124
 
123
- def get_next_change(self, timeout: float = 0.001) -> str | None:
125
+ def get_next_change(self, timeout: float = _WATCHER_TIMEOUT) -> str | None:
124
126
  """Get the next file change event from the queue
125
127
 
126
128
  Args:
@@ -148,7 +150,7 @@ class FileChangedNotifier(threading.Thread):
148
150
  except queue.Empty:
149
151
  return None
150
152
 
151
- def get_all_changes(self, timeout: float = 0.001) -> list[str]:
153
+ def get_all_changes(self, timeout: float = _WATCHER_TIMEOUT) -> list[str]:
152
154
  """Get all file change events from the queue
153
155
 
154
156
  Args:
@@ -185,12 +187,22 @@ def _process_wrapper(root: Path, excluded_patterns: list[str], queue: Queue):
185
187
  watcher.stop()
186
188
 
187
189
 
190
+ class ProcessWraperTask:
191
+ def __init__(self, root: Path, excluded_patterns: list[str], queue: Queue) -> None:
192
+ self.root = root
193
+ self.excluded_patterns = excluded_patterns
194
+ self.queue = queue
195
+
196
+ def run(self):
197
+ _process_wrapper(self.root, self.excluded_patterns, self.queue)
198
+
199
+
188
200
  class FileWatcherProcess:
189
201
  def __init__(self, root: Path, excluded_patterns: list[str]) -> None:
190
202
  self.queue: Queue = Queue()
203
+ task = ProcessWraperTask(root, excluded_patterns, self.queue)
191
204
  self.process = Process(
192
- target=_process_wrapper,
193
- args=(root, excluded_patterns, self.queue),
205
+ target=task.run,
194
206
  daemon=True,
195
207
  )
196
208
  self.process.start()
@@ -45,6 +45,7 @@ def _test_connection(host: str, use_ipv4: bool) -> ConnectionResult:
45
45
  # Function static cache
46
46
  host = _sanitize_host(host)
47
47
  transport = httpx.HTTPTransport(local_address="0.0.0.0") if use_ipv4 else None
48
+ result: ConnectionResult | None = None
48
49
  try:
49
50
  with httpx.Client(
50
51
  timeout=_TIMEOUT,
@@ -56,7 +57,7 @@ def _test_connection(host: str, use_ipv4: bool) -> ConnectionResult:
56
57
  result = ConnectionResult(host, test_response.status_code == 200, use_ipv4)
57
58
  except KeyboardInterrupt:
58
59
  _thread.interrupt_main()
59
-
60
+ result = ConnectionResult(host, False, use_ipv4)
60
61
  except TimeoutError:
61
62
  result = ConnectionResult(host, False, use_ipv4)
62
63
  except Exception:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: fastled
3
- Version: 1.2.47
3
+ Version: 1.2.49
4
4
  Summary: FastLED Wasm Compiler
5
5
  Home-page: https://github.com/zackees/fastled-wasm
6
6
  Maintainer: Zachary Vorhies
@@ -3,6 +3,7 @@ Unit test file.
3
3
  """
4
4
 
5
5
  import random
6
+ import time
6
7
  import unittest
7
8
  from pathlib import Path
8
9
 
@@ -18,7 +19,7 @@ assert INDEX_HTML.exists()
18
19
 
19
20
 
20
21
  # realistic range, 8021 - 8030
21
- PORT = random.randint(8021, 8030)
22
+ PORT = random.randint(8030, 8040)
22
23
  PORT2 = PORT + 1
23
24
 
24
25
 
@@ -32,6 +33,7 @@ class HttpServerTester(unittest.TestCase):
32
33
  response = httpx.get(f"http://localhost:{port}", timeout=1)
33
34
  self.assertEqual(response.status_code, 200)
34
35
  proc.terminate()
36
+ time.sleep(1)
35
37
 
36
38
  def test_http_server_404(self) -> None:
37
39
  """Test the http server returns 404 for non-existent files."""
@@ -40,6 +42,7 @@ class HttpServerTester(unittest.TestCase):
40
42
  response = httpx.get(f"http://localhost:{port}/nonexistent.html", timeout=1)
41
43
  self.assertEqual(response.status_code, 404)
42
44
  proc.terminate()
45
+ time.sleep(1)
43
46
 
44
47
 
45
48
  if __name__ == "__main__":
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes