fastled 1.3.34__tar.gz → 1.3.36__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.
- {fastled-1.3.34 → fastled-1.3.36}/PKG-INFO +1 -1
- fastled-1.3.36/requirements.docker.txt +1 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/__init__.py +6 -1
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/__version__.py +1 -1
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/client_server.py +8 -1
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/compile_server_impl.py +5 -1
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/web_compile.py +2 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled.egg-info/PKG-INFO +1 -1
- fastled-1.3.36/tests/unit/test_no_platformio_compile.py +427 -0
- fastled-1.3.34/requirements.docker.txt +0 -1
- fastled-1.3.34/tests/unit/test_no_platformio_compile.py +0 -472
- {fastled-1.3.34 → fastled-1.3.36}/.aiderignore +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/.cursorrules +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/.dockerignore +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/.github/workflows/build_multi_docker_image.yml +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/.github/workflows/build_webpage.yml +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/.github/workflows/lint.yml +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/.github/workflows/publish_release.yml +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/.github/workflows/template_build_docker_image.yml +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/.github/workflows/test_build_exe.yml +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/.github/workflows/test_macos.yml +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/.github/workflows/test_ubuntu.yml +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/.github/workflows/test_win.yml +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/.gitignore +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/.pylintrc +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/.vscode/launch.json +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/.vscode/settings.json +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/.vscode/tasks.json +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/DEBUGGER.md +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/Dockerfile +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/FAQ.md +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/LICENSE +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/MANIFEST.in +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/README.md +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/RELEASE.md +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/TODO.md +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/build_exe.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/build_local_docker.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/build_site.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/clean +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/compiler/debug.sh +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/compiler/run.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/demo/100dots.html +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/demo/demo_threejs.html +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/demo/micdemo.html +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/demo/mp3upload.html +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/demo/webgl_postprocessing_unreal_bloom.html +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/docker-compose.yml +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/entrypoint.sh +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/install +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/install_linux.sh +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/lint +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/pyproject.toml +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/requirements.testing.txt +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/setup.cfg +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/setup.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/app.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/args.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/assets/example.txt +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/assets/localhost-key.pem +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/assets/localhost.pem +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/cli.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/cli_test.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/cli_test_interactive.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/compile_server.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/docker_manager.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/filewatcher.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/keyboard.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/keyz.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/live_client.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/open_browser.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/parse_args.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/paths.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/print_filter.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/project_init.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/select_sketch_directory.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/server_flask.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/server_start.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/settings.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/site/build.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/site/examples.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/sketch.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/spinner.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/string_diff.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/test/can_run_local_docker_tests.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/test/examples.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/types.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/util.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled/version.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled.egg-info/SOURCES.txt +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled.egg-info/dependency_links.txt +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled.egg-info/entry_points.txt +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled.egg-info/requires.txt +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/src/fastled.egg-info/top_level.txt +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/test +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/integration/test_build_examples.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/integration/test_examples.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/unit/html/index.html +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/unit/test_api.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/unit/test_bad_ino.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/unit/test_banner_string.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/unit/test_cli.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/unit/test_cli_no_platformio.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/unit/test_compile_server.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/unit/test_debug_fetch_source_files.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/unit/test_docker_linux_on_windows.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/unit/test_embedded_data.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/unit/test_filechanger.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/unit/test_flask_headers.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/unit/test_http_server.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/unit/test_ino/bad/bad.ino +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/unit/test_ino/bad_platformio/bad_platformio.ino +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/unit/test_ino/bad_platformio/platformio.ini +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/unit/test_ino/embedded/data/bigdata.dat +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/unit/test_ino/embedded/wasm.ino +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/unit/test_ino/wasm/wasm.ino +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/unit/test_manual_api_invocation.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/unit/test_project_init.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/unit/test_server_and_client_seperatly.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/unit/test_session_compile.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/unit/test_string_diff.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/unit/test_version.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/tests/unit/test_webcompile.py +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/upload_package.sh +0 -0
- {fastled-1.3.34 → fastled-1.3.36}/vscode-plugin/readme +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
fastled-wasm-server>=1.0.93
|
@@ -39,6 +39,7 @@ class Api:
|
|
39
39
|
host: str | CompileServer | None = None,
|
40
40
|
build_mode: BuildMode = BuildMode.QUICK,
|
41
41
|
profile: bool = False, # When true then profile information will be enabled and included in the zip.
|
42
|
+
no_platformio: bool = False,
|
42
43
|
) -> CompileResult:
|
43
44
|
from fastled.web_compile import web_compile
|
44
45
|
|
@@ -47,7 +48,11 @@ class Api:
|
|
47
48
|
if isinstance(directory, str):
|
48
49
|
directory = Path(directory)
|
49
50
|
out: CompileResult = web_compile(
|
50
|
-
directory,
|
51
|
+
directory,
|
52
|
+
host,
|
53
|
+
build_mode=build_mode,
|
54
|
+
profile=profile,
|
55
|
+
no_platformio=no_platformio,
|
51
56
|
)
|
52
57
|
return out
|
53
58
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# IMPORTANT! There's a bug in github which will REJECT any version update
|
2
2
|
# that has any other change in the repo. Please bump the version as the
|
3
3
|
# ONLY change in a commit, or else the pypi update and the release will fail.
|
4
|
-
__version__ = "1.3.
|
4
|
+
__version__ = "1.3.36"
|
5
5
|
|
6
6
|
__version_url_latest__ = "https://raw.githubusercontent.com/zackees/fastled-wasm/refs/heads/main/src/fastled/__version__.py"
|
@@ -76,12 +76,17 @@ def _run_web_compiler(
|
|
76
76
|
build_mode: BuildMode,
|
77
77
|
profile: bool,
|
78
78
|
last_hash_value: str | None,
|
79
|
+
no_platformio: bool = False,
|
79
80
|
) -> CompileResult:
|
80
81
|
input_dir = Path(directory)
|
81
82
|
output_dir = input_dir / "fastled_js"
|
82
83
|
start = time.time()
|
83
84
|
web_result = web_compile(
|
84
|
-
directory=input_dir,
|
85
|
+
directory=input_dir,
|
86
|
+
host=host,
|
87
|
+
build_mode=build_mode,
|
88
|
+
profile=profile,
|
89
|
+
no_platformio=no_platformio,
|
85
90
|
)
|
86
91
|
diff = time.time() - start
|
87
92
|
if not web_result.success:
|
@@ -287,6 +292,7 @@ def run_client(
|
|
287
292
|
build_mode: BuildMode = build_mode,
|
288
293
|
profile: bool = profile,
|
289
294
|
last_hash_value: str | None = None,
|
295
|
+
no_platformio: bool = no_platformio,
|
290
296
|
) -> CompileResult:
|
291
297
|
TEST_BEFORE_COMPILE(url)
|
292
298
|
return _run_web_compiler(
|
@@ -295,6 +301,7 @@ def run_client(
|
|
295
301
|
build_mode=build_mode,
|
296
302
|
profile=profile,
|
297
303
|
last_hash_value=last_hash_value,
|
304
|
+
no_platformio=no_platformio,
|
298
305
|
)
|
299
306
|
|
300
307
|
result: CompileResult = compile_function(last_hash_value=None)
|
@@ -107,7 +107,11 @@ class CompileServerImpl:
|
|
107
107
|
if not self.ping():
|
108
108
|
raise RuntimeError("Server is not running")
|
109
109
|
out: CompileResult = web_compile(
|
110
|
-
directory,
|
110
|
+
directory,
|
111
|
+
host=self.url(),
|
112
|
+
build_mode=build_mode,
|
113
|
+
profile=profile,
|
114
|
+
no_platformio=self.no_platformio,
|
111
115
|
)
|
112
116
|
return out
|
113
117
|
|
@@ -195,6 +195,7 @@ def web_compile(
|
|
195
195
|
auth_token: str | None = None,
|
196
196
|
build_mode: BuildMode | None = None,
|
197
197
|
profile: bool = False,
|
198
|
+
no_platformio: bool = False,
|
198
199
|
) -> CompileResult:
|
199
200
|
start_time = time.time()
|
200
201
|
if isinstance(directory, str):
|
@@ -249,6 +250,7 @@ def web_compile(
|
|
249
250
|
else BuildMode.QUICK.value.lower()
|
250
251
|
),
|
251
252
|
"profile": "true" if profile else "false",
|
253
|
+
"no-platformio": "true" if no_platformio else "false",
|
252
254
|
}
|
253
255
|
|
254
256
|
url = f"{connection_result.host}/{ENDPOINT_COMPILED_WASM}"
|
@@ -0,0 +1,427 @@
|
|
1
|
+
"""
|
2
|
+
Real integration tests for FastLED API compilation without PlatformIO constraints.
|
3
|
+
Tests that sketches can be compiled successfully using actual test ino files
|
4
|
+
without relying on extensive mocking.
|
5
|
+
"""
|
6
|
+
|
7
|
+
import os
|
8
|
+
import platform
|
9
|
+
import unittest
|
10
|
+
from pathlib import Path
|
11
|
+
from tempfile import TemporaryDirectory
|
12
|
+
|
13
|
+
from fastled import Api
|
14
|
+
from fastled.compile_server_impl import CompileServerImpl
|
15
|
+
from fastled.docker_manager import DockerManager
|
16
|
+
from fastled.types import BuildMode, CompileResult
|
17
|
+
|
18
|
+
HERE = Path(__file__).parent
|
19
|
+
TEST_SKETCH_DIR = HERE / "test_ino" / "wasm"
|
20
|
+
EMBEDDED_TEST_SKETCH_DIR = HERE / "test_ino" / "embedded"
|
21
|
+
|
22
|
+
|
23
|
+
def _enabled() -> bool:
|
24
|
+
"""Check if this system can run the tests."""
|
25
|
+
is_github_runner = "GITHUB_ACTIONS" in os.environ
|
26
|
+
if not is_github_runner:
|
27
|
+
return True
|
28
|
+
# This only works in ubuntu at the moment
|
29
|
+
return platform.system() == "Linux"
|
30
|
+
|
31
|
+
|
32
|
+
def _docker_available() -> bool:
|
33
|
+
"""Check if Docker is available for no-platformio compilation."""
|
34
|
+
try:
|
35
|
+
return DockerManager.is_docker_installed()
|
36
|
+
except Exception as e:
|
37
|
+
print(f"Docker is not available: {e}")
|
38
|
+
return False
|
39
|
+
|
40
|
+
|
41
|
+
class NoPlatformIOCompileTester(unittest.TestCase):
|
42
|
+
"""Real integration tests for FastLED API compilation bypassing Platformio constraints."""
|
43
|
+
|
44
|
+
@unittest.skipUnless(
|
45
|
+
_enabled() and _docker_available(),
|
46
|
+
"Requires Docker for no-platformio compilation.",
|
47
|
+
)
|
48
|
+
def test_no_platformio_compile_wasm_sketch(self) -> None:
|
49
|
+
"""Test that the wasm test sketch compiles successfully with no-platformio mode.
|
50
|
+
|
51
|
+
This is a real integration test that:
|
52
|
+
1. Uses an actual test ino file (wasm.ino)
|
53
|
+
2. Actually starts a compile server with no_platformio=True
|
54
|
+
3. Actually compiles the sketch without mocking
|
55
|
+
4. Verifies the compilation succeeds and produces output
|
56
|
+
"""
|
57
|
+
# Ensure test sketch directory exists
|
58
|
+
self.assertTrue(
|
59
|
+
TEST_SKETCH_DIR.exists(),
|
60
|
+
f"Test sketch directory not found: {TEST_SKETCH_DIR}",
|
61
|
+
)
|
62
|
+
|
63
|
+
# Verify test sketch file exists
|
64
|
+
test_sketch_file = TEST_SKETCH_DIR / "wasm.ino"
|
65
|
+
self.assertTrue(
|
66
|
+
test_sketch_file.exists(), f"Test sketch file not found: {test_sketch_file}"
|
67
|
+
)
|
68
|
+
|
69
|
+
# Start compile server with no_platformio=True for real integration test
|
70
|
+
server_impl = CompileServerImpl(no_platformio=True, auto_start=True)
|
71
|
+
|
72
|
+
try:
|
73
|
+
# Check if server is running
|
74
|
+
running, error = server_impl.running
|
75
|
+
self.assertTrue(running, f"No-platformio server should be running: {error}")
|
76
|
+
|
77
|
+
# Compile the test sketch using no-platformio mode
|
78
|
+
result: CompileResult = server_impl.web_compile(
|
79
|
+
directory=TEST_SKETCH_DIR,
|
80
|
+
build_mode=BuildMode.QUICK, # Use quick mode for faster compilation
|
81
|
+
profile=False,
|
82
|
+
)
|
83
|
+
|
84
|
+
# Verify no-platformio compilation succeeded
|
85
|
+
self.assertTrue(
|
86
|
+
result.success,
|
87
|
+
f"No-platformio compilation failed. Output: {result.stdout}",
|
88
|
+
)
|
89
|
+
|
90
|
+
# Verify we got actual compiled output
|
91
|
+
self.assertTrue(
|
92
|
+
len(result.zip_bytes) > 0,
|
93
|
+
"No compiled output received from no-platformio mode",
|
94
|
+
)
|
95
|
+
|
96
|
+
# Verify stdout contains expected compilation messages
|
97
|
+
self.assertIsNotNone(
|
98
|
+
result.stdout, "No stdout received from no-platformio compilation"
|
99
|
+
)
|
100
|
+
|
101
|
+
print("✅ No-platformio wasm sketch compilation successful!")
|
102
|
+
print(f"Compiled zip size: {len(result.zip_bytes)} bytes")
|
103
|
+
if result.hash_value:
|
104
|
+
print(f"Hash: {result.hash_value}")
|
105
|
+
|
106
|
+
finally:
|
107
|
+
# Ensure cleanup
|
108
|
+
try:
|
109
|
+
server_impl.stop()
|
110
|
+
except Exception as e:
|
111
|
+
print(f"Cleanup warning: {e}")
|
112
|
+
|
113
|
+
@unittest.skipUnless(
|
114
|
+
_enabled() and _docker_available(),
|
115
|
+
"Requires Docker for no-platformio compilation.",
|
116
|
+
)
|
117
|
+
def test_no_platformio_vs_regular_compilation(self) -> None:
|
118
|
+
"""Test that compares no-platformio mode vs regular mode compilation.
|
119
|
+
|
120
|
+
This real integration test verifies that:
|
121
|
+
1. Both modes can compile the same sketch
|
122
|
+
2. Both produce valid output
|
123
|
+
3. The no-platformio flag actually affects the compilation process
|
124
|
+
"""
|
125
|
+
# Test with regular mode first
|
126
|
+
server_regular = CompileServerImpl(no_platformio=False, auto_start=True)
|
127
|
+
|
128
|
+
try:
|
129
|
+
# Test regular compilation
|
130
|
+
running, error = server_regular.running
|
131
|
+
self.assertTrue(running, f"Regular server should be running: {error}")
|
132
|
+
|
133
|
+
result_regular: CompileResult = server_regular.web_compile(
|
134
|
+
directory=TEST_SKETCH_DIR,
|
135
|
+
build_mode=BuildMode.QUICK,
|
136
|
+
profile=False,
|
137
|
+
)
|
138
|
+
|
139
|
+
self.assertTrue(
|
140
|
+
result_regular.success,
|
141
|
+
f"Regular compilation failed. Output: {result_regular.stdout}",
|
142
|
+
)
|
143
|
+
self.assertTrue(len(result_regular.zip_bytes) > 0)
|
144
|
+
|
145
|
+
finally:
|
146
|
+
# Stop regular server completely before starting no-platformio server
|
147
|
+
try:
|
148
|
+
server_regular.stop()
|
149
|
+
except Exception as e:
|
150
|
+
print(f"Cleanup warning for regular server: {e}")
|
151
|
+
|
152
|
+
# Now test no-platformio compilation after regular server is stopped
|
153
|
+
server_no_platformio = CompileServerImpl(no_platformio=True, auto_start=True)
|
154
|
+
|
155
|
+
try:
|
156
|
+
# Test no-platformio compilation
|
157
|
+
running, error = server_no_platformio.running
|
158
|
+
self.assertTrue(running, f"No-platformio server should be running: {error}")
|
159
|
+
|
160
|
+
result_no_platformio: CompileResult = server_no_platformio.web_compile(
|
161
|
+
directory=TEST_SKETCH_DIR,
|
162
|
+
build_mode=BuildMode.QUICK,
|
163
|
+
profile=False,
|
164
|
+
)
|
165
|
+
|
166
|
+
self.assertTrue(
|
167
|
+
result_no_platformio.success,
|
168
|
+
f"No-platformio compilation failed. Output: {result_no_platformio.stdout}",
|
169
|
+
)
|
170
|
+
self.assertTrue(len(result_no_platformio.zip_bytes) > 0)
|
171
|
+
|
172
|
+
print("✅ Both regular and no-platformio compilation modes work!")
|
173
|
+
print(f"Regular output size: {len(result_regular.zip_bytes)} bytes")
|
174
|
+
print(
|
175
|
+
f"No-platformio output size: {len(result_no_platformio.zip_bytes)} bytes"
|
176
|
+
)
|
177
|
+
|
178
|
+
finally:
|
179
|
+
# Cleanup no-platformio server
|
180
|
+
try:
|
181
|
+
server_no_platformio.stop()
|
182
|
+
except Exception as e:
|
183
|
+
print(f"Cleanup warning for no-platformio server: {e}")
|
184
|
+
|
185
|
+
@unittest.skipUnless(
|
186
|
+
_enabled() and _docker_available(),
|
187
|
+
"Requires Docker for no-platformio compilation.",
|
188
|
+
)
|
189
|
+
def test_no_platformio_embedded_sketch(self) -> None:
|
190
|
+
"""Test that the embedded test sketch compiles successfully with no-platformio mode.
|
191
|
+
|
192
|
+
This tests a different sketch to ensure no-platformio mode works with
|
193
|
+
various types of FastLED sketches, not just one specific example.
|
194
|
+
"""
|
195
|
+
# Ensure embedded test sketch directory exists
|
196
|
+
self.assertTrue(
|
197
|
+
EMBEDDED_TEST_SKETCH_DIR.exists(),
|
198
|
+
f"Embedded test sketch directory not found: {EMBEDDED_TEST_SKETCH_DIR}",
|
199
|
+
)
|
200
|
+
|
201
|
+
# Verify test sketch file exists
|
202
|
+
test_sketch_file = EMBEDDED_TEST_SKETCH_DIR / "wasm.ino"
|
203
|
+
self.assertTrue(
|
204
|
+
test_sketch_file.exists(),
|
205
|
+
f"Embedded test sketch file not found: {test_sketch_file}",
|
206
|
+
)
|
207
|
+
|
208
|
+
# Start compile server with no_platformio=True
|
209
|
+
server_impl = CompileServerImpl(no_platformio=True, auto_start=True)
|
210
|
+
|
211
|
+
try:
|
212
|
+
# Check if server is running
|
213
|
+
running, error = server_impl.running
|
214
|
+
self.assertTrue(running, f"No-platformio server should be running: {error}")
|
215
|
+
|
216
|
+
# Compile the embedded test sketch
|
217
|
+
result: CompileResult = server_impl.web_compile(
|
218
|
+
directory=EMBEDDED_TEST_SKETCH_DIR,
|
219
|
+
build_mode=BuildMode.QUICK,
|
220
|
+
profile=False,
|
221
|
+
)
|
222
|
+
|
223
|
+
# Verify compilation succeeded
|
224
|
+
self.assertTrue(
|
225
|
+
result.success,
|
226
|
+
f"No-platformio embedded sketch compilation failed. Output: {result.stdout}",
|
227
|
+
)
|
228
|
+
|
229
|
+
self.assertTrue(
|
230
|
+
len(result.zip_bytes) > 0,
|
231
|
+
"No compiled output received from embedded sketch compilation",
|
232
|
+
)
|
233
|
+
|
234
|
+
print("✅ No-platformio embedded sketch compilation successful!")
|
235
|
+
print(f"Compiled zip size: {len(result.zip_bytes)} bytes")
|
236
|
+
|
237
|
+
finally:
|
238
|
+
try:
|
239
|
+
server_impl.stop()
|
240
|
+
except Exception as e:
|
241
|
+
print(f"Cleanup warning: {e}")
|
242
|
+
|
243
|
+
@unittest.skipUnless(
|
244
|
+
_enabled() and _docker_available(),
|
245
|
+
"Requires Docker for no-platformio compilation.",
|
246
|
+
)
|
247
|
+
def test_no_platformio_different_build_modes(self) -> None:
|
248
|
+
"""Test no-platformio compilation with different build modes using real compilation."""
|
249
|
+
|
250
|
+
self.assertTrue(
|
251
|
+
TEST_SKETCH_DIR.exists(),
|
252
|
+
f"Test sketch directory not found: {TEST_SKETCH_DIR}",
|
253
|
+
)
|
254
|
+
|
255
|
+
build_modes = [BuildMode.QUICK, BuildMode.DEBUG, BuildMode.RELEASE]
|
256
|
+
server_impl = CompileServerImpl(no_platformio=True, auto_start=True)
|
257
|
+
|
258
|
+
try:
|
259
|
+
# Check if server is running
|
260
|
+
running, error = server_impl.running
|
261
|
+
self.assertTrue(running, f"No-platformio server should be running: {error}")
|
262
|
+
|
263
|
+
for build_mode in build_modes:
|
264
|
+
with self.subTest(build_mode=build_mode):
|
265
|
+
print(
|
266
|
+
f"Testing no-platformio compilation with {build_mode.value} mode..."
|
267
|
+
)
|
268
|
+
|
269
|
+
result: CompileResult = server_impl.web_compile(
|
270
|
+
directory=TEST_SKETCH_DIR, build_mode=build_mode, profile=False
|
271
|
+
)
|
272
|
+
|
273
|
+
# Verify compilation succeeded for each build mode
|
274
|
+
self.assertTrue(
|
275
|
+
result.success,
|
276
|
+
f"No-platformio compilation failed for {build_mode.value} mode. Output: {result.stdout}",
|
277
|
+
)
|
278
|
+
|
279
|
+
# Verify we got output
|
280
|
+
self.assertTrue(
|
281
|
+
len(result.zip_bytes) > 0,
|
282
|
+
f"No compiled output received for no-platformio {build_mode.value} mode",
|
283
|
+
)
|
284
|
+
|
285
|
+
print(
|
286
|
+
f"✅ No-platformio {build_mode.value} mode compilation successful! "
|
287
|
+
f"Output size: {len(result.zip_bytes)} bytes"
|
288
|
+
)
|
289
|
+
finally:
|
290
|
+
try:
|
291
|
+
server_impl.stop()
|
292
|
+
except Exception as e:
|
293
|
+
print(f"Cleanup warning: {e}")
|
294
|
+
|
295
|
+
@unittest.skipUnless(
|
296
|
+
_enabled() and _docker_available(),
|
297
|
+
"Requires Docker for no-platformio compilation.",
|
298
|
+
)
|
299
|
+
def test_no_platformio_compile_with_project_init(self) -> None:
|
300
|
+
"""Test that a project initialized via API can be compiled in no-platformio mode."""
|
301
|
+
|
302
|
+
with TemporaryDirectory() as tmpdir:
|
303
|
+
server_impl = CompileServerImpl(no_platformio=True, auto_start=True)
|
304
|
+
|
305
|
+
try:
|
306
|
+
# Check if server is running
|
307
|
+
running, error = server_impl.running
|
308
|
+
self.assertTrue(
|
309
|
+
running, f"No-platformio server should be running: {error}"
|
310
|
+
)
|
311
|
+
|
312
|
+
# Initialize a new project with the Blink example
|
313
|
+
sketch_directory = Api.project_init(
|
314
|
+
example="Blink", outputdir=tmpdir, host=server_impl.url()
|
315
|
+
)
|
316
|
+
|
317
|
+
self.assertTrue(
|
318
|
+
sketch_directory.exists(), "Project initialization failed"
|
319
|
+
)
|
320
|
+
|
321
|
+
# Compile the initialized project in no-platformio mode
|
322
|
+
result: CompileResult = server_impl.web_compile(
|
323
|
+
directory=sketch_directory,
|
324
|
+
build_mode=BuildMode.QUICK,
|
325
|
+
profile=False,
|
326
|
+
)
|
327
|
+
|
328
|
+
# Verify no-platformio compilation succeeded
|
329
|
+
self.assertTrue(
|
330
|
+
result.success,
|
331
|
+
f"No-platformio compilation of initialized project failed. Output: {result.stdout}",
|
332
|
+
)
|
333
|
+
self.assertTrue(
|
334
|
+
len(result.zip_bytes) > 0,
|
335
|
+
"No compiled output received from no-platformio initialized project",
|
336
|
+
)
|
337
|
+
|
338
|
+
print(
|
339
|
+
"✅ Successfully compiled initialized Blink project in no-platformio mode!"
|
340
|
+
)
|
341
|
+
print(f"Project directory: {sketch_directory}")
|
342
|
+
print(f"Compiled output size: {len(result.zip_bytes)} bytes")
|
343
|
+
finally:
|
344
|
+
try:
|
345
|
+
server_impl.stop()
|
346
|
+
except Exception as e:
|
347
|
+
print(f"Cleanup warning: {e}")
|
348
|
+
|
349
|
+
def test_no_platformio_api_structure_and_workflow(self) -> None:
|
350
|
+
"""Test that demonstrates the no-platformio FastLED API structure and workflow.
|
351
|
+
|
352
|
+
This test shows how to use the FastLED API for no-platformio compilation even
|
353
|
+
if Docker is not available. It demonstrates the API structure and intended
|
354
|
+
workflow for bypassing PlatformIO constraints.
|
355
|
+
"""
|
356
|
+
|
357
|
+
# Verify test sketch exists
|
358
|
+
self.assertTrue(
|
359
|
+
TEST_SKETCH_DIR.exists(),
|
360
|
+
f"Test sketch directory not found: {TEST_SKETCH_DIR}",
|
361
|
+
)
|
362
|
+
test_sketch_file = TEST_SKETCH_DIR / "wasm.ino"
|
363
|
+
self.assertTrue(
|
364
|
+
test_sketch_file.exists(), f"Test sketch file not found: {test_sketch_file}"
|
365
|
+
)
|
366
|
+
|
367
|
+
# Check Docker availability
|
368
|
+
docker_available = _docker_available()
|
369
|
+
print(f"Docker available for no-platformio mode: {docker_available}")
|
370
|
+
|
371
|
+
if not docker_available:
|
372
|
+
print(
|
373
|
+
"Docker not available - demonstrating no-platformio API structure without compilation"
|
374
|
+
)
|
375
|
+
print("To enable full no-platformio compilation with Docker:")
|
376
|
+
print("1. Install Docker")
|
377
|
+
print("2. Start Docker daemon")
|
378
|
+
print("3. Ensure user has Docker permissions")
|
379
|
+
print("4. Run: fastled --server")
|
380
|
+
print(
|
381
|
+
"5. Use CompileServerImpl(no_platformio=True) for no-platformio compilation"
|
382
|
+
)
|
383
|
+
print("")
|
384
|
+
print("No-platformio compilation advantages:")
|
385
|
+
print("- Bypass PlatformIO build constraints and limitations")
|
386
|
+
print("- Direct access to compiler toolchain and flags")
|
387
|
+
print("- Custom build environment configuration")
|
388
|
+
print("- Advanced compilation modes not restricted by PlatformIO")
|
389
|
+
print("- Full control over build process and dependencies")
|
390
|
+
return
|
391
|
+
|
392
|
+
# If Docker is available, we would run the actual test
|
393
|
+
print("Docker is available - running no-platformio API validation")
|
394
|
+
|
395
|
+
# Test API imports and basic structure
|
396
|
+
self.assertTrue(
|
397
|
+
hasattr(Api, "server"),
|
398
|
+
"Api should have server method for no-platformio mode",
|
399
|
+
)
|
400
|
+
self.assertTrue(
|
401
|
+
hasattr(Api, "project_init"), "Api should have project_init method"
|
402
|
+
)
|
403
|
+
|
404
|
+
# Test BuildMode enum
|
405
|
+
self.assertTrue(
|
406
|
+
hasattr(BuildMode, "QUICK"), "BuildMode should have QUICK for no-platformio"
|
407
|
+
)
|
408
|
+
self.assertTrue(
|
409
|
+
hasattr(BuildMode, "DEBUG"), "BuildMode should have DEBUG for no-platformio"
|
410
|
+
)
|
411
|
+
self.assertTrue(
|
412
|
+
hasattr(BuildMode, "RELEASE"),
|
413
|
+
"BuildMode should have RELEASE for no-platformio",
|
414
|
+
)
|
415
|
+
|
416
|
+
print("FastLED no-platformio API structure validated successfully")
|
417
|
+
print("To compile in no-platformio equivalent mode:")
|
418
|
+
print(
|
419
|
+
"- Use CompileServerImpl(no_platformio=True) for local Docker compilation"
|
420
|
+
)
|
421
|
+
print("- Configure build flags to bypass PlatformIO constraints")
|
422
|
+
print("- Utilize CompileServer.web_compile() with custom settings")
|
423
|
+
print("- Access advanced build modes not available via standard PlatformIO")
|
424
|
+
|
425
|
+
|
426
|
+
if __name__ == "__main__":
|
427
|
+
unittest.main()
|
@@ -1 +0,0 @@
|
|
1
|
-
fastled-wasm-server>=1.0.92
|