Skip to content

Commit bc09278

Browse files
committed
updated tests and fixed some error wording
1 parent 8ab6c9b commit bc09278

File tree

15 files changed

+41
-36
lines changed

15 files changed

+41
-36
lines changed

commands/board/attach.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func Attach(ctx context.Context, req *rpc.BoardAttachRequest, taskCB commands.Ta
4646
}
4747
sk, err := sketch.New(sketchPath)
4848
if err != nil {
49-
return nil, &commands.SketchNotFoundError{Cause: err}
49+
return nil, &commands.CantOpenSketchError{Cause: err}
5050
}
5151

5252
boardURI := req.GetBoardUri()

commands/compile/compile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
9999
sketchPath := paths.New(req.GetSketchPath())
100100
sk, err := sketch.New(sketchPath)
101101
if err != nil {
102-
return nil, &commands.SketchNotFoundError{Cause: err}
102+
return nil, &commands.CantOpenSketchError{Cause: err}
103103
}
104104

105105
fqbnIn := req.GetFqbn()

commands/debug/debug_info.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func getDebugProperties(req *debug.DebugConfigRequest, pm *packagemanager.Packag
4444
sketchPath := paths.New(req.GetSketchPath())
4545
sk, err := sketch.New(sketchPath)
4646
if err != nil {
47-
return nil, &commands.SketchNotFoundError{Cause: err}
47+
return nil, &commands.CantOpenSketchError{Cause: err}
4848
}
4949

5050
// XXX Remove this code duplication!!

commands/errors.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -304,20 +304,20 @@ func (e *MissingSketchPathError) ToRPCStatus() *status.Status {
304304
return status.New(codes.InvalidArgument, e.Error())
305305
}
306306

307-
// SketchNotFoundError is returned when the sketch is not found
308-
type SketchNotFoundError struct {
307+
// CantOpenSketchError is returned when the sketch is not found or cannot be opened
308+
type CantOpenSketchError struct {
309309
Cause error
310310
}
311311

312-
func (e *SketchNotFoundError) Error() string {
313-
return composeErrorMsg(tr("Sketch not found"), e.Cause)
312+
func (e *CantOpenSketchError) Error() string {
313+
return composeErrorMsg(tr("Can't open sketch"), e.Cause)
314314
}
315315

316-
func (e *SketchNotFoundError) Unwrap() error {
316+
func (e *CantOpenSketchError) Unwrap() error {
317317
return e.Cause
318318
}
319319

320-
func (e *SketchNotFoundError) ToRPCStatus() *status.Status {
320+
func (e *CantOpenSketchError) ToRPCStatus() *status.Status {
321321
return status.New(codes.NotFound, e.Error())
322322
}
323323

commands/instances.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ func LoadSketch(ctx context.Context, req *rpc.LoadSketchRequest) (*rpc.LoadSketc
862862
// TODO: This should be a ToRpc function for the Sketch struct
863863
sketch, err := sk.New(paths.New(req.SketchPath))
864864
if err != nil {
865-
return nil, &SketchNotFoundError{Cause: err}
865+
return nil, &CantOpenSketchError{Cause: err}
866866
}
867867

868868
otherSketchFiles := make([]string, sketch.OtherSketchFiles.Len())

commands/sketch/archive.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func ArchiveSketch(ctx context.Context, req *rpc.ArchiveSketchRequest) (*rpc.Arc
4343

4444
s, err := sketch.New(sketchPath)
4545
if err != nil {
46-
return nil, &commands.SketchNotFoundError{Cause: err}
46+
return nil, &commands.CantOpenSketchError{Cause: err}
4747
}
4848

4949
sketchPath = s.FullPath

commands/upload/upload.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func Upload(ctx context.Context, req *rpc.UploadRequest, outStream io.Writer, er
123123
sketchPath := paths.New(req.GetSketchPath())
124124
sk, err := sketch.New(sketchPath)
125125
if err != nil && req.GetImportDir() == "" && req.GetImportFile() == "" {
126-
return nil, &commands.SketchNotFoundError{Cause: err}
126+
return nil, &commands.CantOpenSketchError{Cause: err}
127127
}
128128

129129
pm := commands.GetPackageManager(req.GetInstance().GetId())

test/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def _run(cmd_string, custom_working_dir=None, custom_env=None):
141141
# It escapes spaces in the path using "\ " but it doesn't always work,
142142
# wrapping the path in quotation marks is the safest approach
143143
with run_context.prefix(f'{cd_command} "{custom_working_dir}"'):
144-
return run_context.run(cli_full_line, echo=False, hide=True, warn=True, env=custom_env, encoding="utf-8")
144+
return run_context.run(cli_full_line, echo=False, hide=False, warn=True, env=custom_env, encoding="utf-8")
145145

146146
return _run
147147

test/pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ markers =
1414
# -n=auto sets the numbers of parallel processes to use
1515
# --dist=loadfile distributes the tests in the parallel processes dividing them per file
1616
# See https://pypi.org/project/pytest-xdist/#parallelization for more info on parallelization
17-
addopts = -x -s --verbose --tb=long -n=auto --dist=loadfile
17+
addopts = -x -s --verbose

test/test_board.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ def test_board_details_no_flags(run_command):
528528
run_command("core install arduino:[email protected]")
529529
result = run_command("board details")
530530
assert not result.ok
531-
assert "Error getting board details: parsing fqbn: invalid fqbn:" in result.stderr
531+
assert "Error getting board details: Invalid FQBN:" in result.stderr
532532
assert result.stdout == ""
533533

534534

0 commit comments

Comments
 (0)