Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit bcf9061

Browse files
committedNov 9, 2020
[skip changelog] Fix sketch tests on Windows
1 parent b9f4d31 commit bcf9061

File tree

1 file changed

+17
-27
lines changed

1 file changed

+17
-27
lines changed
 

‎test/test_sketch.py

+17-27
Original file line numberDiff line numberDiff line change
@@ -12,54 +12,44 @@
1212
# otherwise use the software for commercial activities involving the Arduino
1313
# software without disclosing the source code of your own applications. To purchase
1414
# a commercial license, send an email to license@arduino.cc.
15-
import os
16-
import platform
1715
import zipfile
1816
from pathlib import Path
1917

20-
import pytest
2118

22-
from test.common import running_on_ci
23-
24-
25-
@pytest.mark.skipif(
26-
running_on_ci() and platform.system() == "Windows",
27-
reason="Test disabled on Github Actions Win VM until tmpdir inconsistent behavior bug is fixed",
28-
)
2919
def test_sketch_new(run_command, working_dir):
3020
# Create a test sketch in current directory
3121
current_path = working_dir
3222
sketch_name = "SketchNewIntegrationTest"
33-
current_sketch_path = os.path.join(current_path, sketch_name)
34-
result = run_command("sketch new {}".format(sketch_name))
23+
current_sketch_path = Path(current_path, sketch_name)
24+
result = run_command(f"sketch new {sketch_name}")
3525
assert result.ok
36-
assert "Sketch created in: {}".format(current_sketch_path) in result.stdout
37-
assert os.path.isfile(os.path.join(current_sketch_path, sketch_name + ".ino"))
26+
assert f"Sketch created in: {current_sketch_path}" in result.stdout
27+
assert Path(current_sketch_path, f"{sketch_name}.ino").is_file()
3828

3929
# Create a test sketch in current directory but using an absolute path
4030
sketch_name = "SketchNewIntegrationTestAbsolute"
41-
current_sketch_path = os.path.join(current_path, sketch_name)
42-
result = run_command("sketch new {}".format(current_sketch_path))
31+
current_sketch_path = Path(current_path, sketch_name)
32+
result = run_command(f'sketch new "{current_sketch_path}"')
4333
assert result.ok
44-
assert "Sketch created in: {}".format(current_sketch_path) in result.stdout
45-
assert os.path.isfile(os.path.join(current_sketch_path, sketch_name + ".ino"))
34+
assert f"Sketch created in: {current_sketch_path}" in result.stdout
35+
assert Path(current_sketch_path, f"{sketch_name}.ino").is_file()
4636

4737
# Create a test sketch in current directory subpath but using an absolute path
4838
sketch_name = "SketchNewIntegrationTestSubpath"
49-
sketch_subpath = os.path.join("subpath", sketch_name)
50-
current_sketch_path = os.path.join(current_path, sketch_subpath)
51-
result = run_command("sketch new {}".format(sketch_subpath))
39+
sketch_subpath = Path("subpath", sketch_name)
40+
current_sketch_path = Path(current_path, sketch_subpath)
41+
result = run_command(f"sketch new {sketch_subpath}")
5242
assert result.ok
53-
assert "Sketch created in: {}".format(current_sketch_path) in result.stdout
54-
assert os.path.isfile(os.path.join(current_sketch_path, sketch_name + ".ino"))
43+
assert f"Sketch created in: {current_sketch_path}" in result.stdout
44+
assert Path(current_sketch_path, f"{sketch_name}.ino").is_file()
5545

5646
# Create a test sketch in current directory using .ino extension
5747
sketch_name = "SketchNewIntegrationTestDotIno"
58-
current_sketch_path = os.path.join(current_path, sketch_name)
59-
result = run_command("sketch new {}".format(sketch_name + ".ino"))
48+
current_sketch_path = Path(current_path, sketch_name)
49+
result = run_command(f"sketch new {sketch_name}.ino")
6050
assert result.ok
61-
assert "Sketch created in: {}".format(current_sketch_path) in result.stdout
62-
assert os.path.isfile(os.path.join(current_sketch_path, sketch_name + ".ino"))
51+
assert f"Sketch created in: {current_sketch_path}" in result.stdout
52+
assert Path(current_sketch_path, f"{sketch_name}.ino").is_file()
6353

6454

6555
def verify_zip_contains_sketch_excluding_build_dir(files):

0 commit comments

Comments
 (0)
Please sign in to comment.