Skip to content

Commit ece38ad

Browse files
committed
Use paths relative to the test.py file
1 parent d59cb17 commit ece38ad

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/test.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ def test(example, test_data, serial_handle):
133133
- python test.py PORT
134134
'''))
135135

136+
file_directory = os.path.dirname(os.path.realpath(__file__))
137+
136138
parser.add_argument("port",
137139
type=str,
138140
help="Device port (COMx, /dev/ttyACMx etc.)")
@@ -153,7 +155,7 @@ def test(example, test_data, serial_handle):
153155
"--testsfile",
154156
type=str,
155157
help="Path to JSON file with tests",
156-
default="tests.json")
158+
default=f"{file_directory}/tests.json")
157159

158160
parser.add_argument("-e",
159161
"--examples",
@@ -165,13 +167,13 @@ def test(example, test_data, serial_handle):
165167
"--sketchdir",
166168
type=str,
167169
help="Relative path to the example directory with the example sketches",
168-
default="../examples")
170+
default=f"{file_directory}/../examples")
169171

170172
parser.add_argument("-b",
171173
"--builddir",
172174
type=str,
173175
help="Relative path to the build directory",
174-
default="build")
176+
default=f"{file_directory}/build")
175177

176178
arguments = parser.parse_args()
177179

0 commit comments

Comments
 (0)