@@ -90,17 +90,24 @@ def run(
9090 pyproject_path = project_path / "pyproject.toml"
9191 if pyproject_path .exists ():
9292 with open (pyproject_path , "rb" ) as fp :
93- d = tomllib .load (fp )
93+ try :
94+ d = tomllib .load (fp )
95+ except tomllib .TOMLDecodeError as e :
96+ print (f"ERROR: { pyproject_path } : { e } " , file = sys .stderr )
97+ return 1
9498
9599 try :
96100 v = d ["tool" ]["robotpy" ]["testing" ]["isolated" ]
97101 except KeyError :
98102 pass
99103 else :
100104 if not isinstance (v , bool ):
101- raise ValueError (
102- f"tool.robotpy.testing.isolated must be a boolean value (got { v } )"
105+ print (
106+ f"ERROR: { pyproject_path } : tool.robotpy.testing.isolated "
107+ f"must be a boolean value (got { v !r} )" ,
108+ file = sys .stderr ,
103109 )
110+ return 1
104111
105112 isolated = v
106113
@@ -162,7 +169,10 @@ def _run_test(
162169 break
163170 else :
164171 if not builtin :
165- print ("ERROR: Cannot run robot tests, as test directory was not found!" )
172+ print (
173+ "ERROR: Cannot run robot tests, as test directory was not found!" ,
174+ file = sys .stderr ,
175+ )
166176 retv = self ._no_tests (main_file , project_path )
167177 return 1
168178
@@ -194,8 +204,11 @@ def _run_test(
194204
195205 # requires pytest 2.8.x
196206 if retv == 5 :
197- print ()
198- print ("ERROR: a tests directory was found, but no tests were defined" )
207+ print (file = sys .stderr )
208+ print (
209+ "ERROR: a tests directory was found, but no tests were defined" ,
210+ file = sys .stderr ,
211+ )
199212 retv = self ._no_tests (main_file , project_path , retv )
200213
201214 return retv
0 commit comments