Skip to content

Commit

Permalink
Fixes tests for code quality linters
Browse files Browse the repository at this point in the history
  • Loading branch information
bvobart committed Aug 12, 2021
1 parent 6826d72 commit 7e2a29d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions setools/cqlinters/bandit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestBanditRun(t *testing.T) {
}

exec.CommandOutput = mockexec.ExpectCommand(t).Dir(project.Dir).
CommandName("bandit").CommandArgs("-f", "yaml", "-x", ".venv,venv", "-r", project.Dir).
CommandName("bandit").CommandArgs("-f", "yaml", "-x", ".env,.venv,env,venv,ENV,env.bak,venv.bak", "-r", project.Dir).
ToOutput([]byte(testBanditOutput), errors.New("bandit always exits with an error when there are messages"))

results, err := l.Run(project)
Expand All @@ -64,7 +64,7 @@ func TestBanditRun(t *testing.T) {
}

exec.CommandOutput = mockexec.ExpectCommand(t).Dir(project.Dir).
CommandName("bandit").CommandArgs("-f", "yaml", "-x", ".venv,venv", "-r", project.Dir).
CommandName("bandit").CommandArgs("-f", "yaml", "-x", ".env,.venv,env,venv,ENV,env.bak,venv.bak", "-r", project.Dir).
ToOutput([]byte(testBanditErrorOutput), errors.New("bandit always exits with an error when there are messages"))

results, err := l.Run(project)
Expand Down
4 changes: 2 additions & 2 deletions setools/cqlinters/black_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestBlackRun(t *testing.T) {
}

exec.CommandCombinedOutput = mockexec.ExpectCommand(t).Dir(project.Dir).
CommandName("black").CommandArgs("--check", "--extend-exclude", ".venv", project.Dir).
CommandName("black").CommandArgs("--check", "--extend-exclude", "/(\\.env|\\.venv|env|venv|ENV|env\\.bak|venv\\.bak)/", project.Dir).
ToOutput([]byte(testBlackOutput), errors.New("black always exits with an error when there are messages"))

results, err := l.Run(project)
Expand All @@ -81,7 +81,7 @@ func TestBlackRun(t *testing.T) {
}

exec.CommandCombinedOutput = mockexec.ExpectCommand(t).Dir(project.Dir).
CommandName("black").CommandArgs("--check", "--extend-exclude", ".venv", project.Dir).
CommandName("black").CommandArgs("--check", "--extend-exclude", "/(\\.env|\\.venv|env|venv|ENV|env\\.bak|venv\\.bak)/", project.Dir).
ToOutput([]byte(testBlackSuccessOutput), nil)

results, err := l.Run(project)
Expand Down
2 changes: 1 addition & 1 deletion setools/cqlinters/isort_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestISortRun(t *testing.T) {
return func(dir, name string, args ...string) ([]byte, error) {
require.Equal(t, project.Dir, dir)
require.Equal(t, "isort", name)
require.Equal(t, []string{"-c", project.Dir}, args)
require.Equal(t, []string{"-c", project.Dir, "--extend-skip", ".env", "--extend-skip", ".venv", "--extend-skip", "env", "--extend-skip", "venv", "--extend-skip", "ENV", "--extend-skip", "env.bak", "--extend-skip", "venv.bak"}, args)
return []byte(output), err
}
}
Expand Down
4 changes: 2 additions & 2 deletions setools/cqlinters/mypy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func TestMypyRun(t *testing.T) {
exec.CommandOutput = func(dir, name string, args ...string) ([]byte, error) {
require.Equal(t, project.Dir, dir)
require.Equal(t, "mypy", name)
require.Equal(t, []string{project.Dir, "--strict", "--no-pretty", "--no-error-summary", "--no-color-output", "--hide-error-context", "--show-error-codes", "--show-column-numbers"}, args)
require.Equal(t, []string{project.Dir, "--exclude", "/(\\.env|\\.venv|env|venv|ENV|env\\.bak|venv\\.bak)/", "--strict", "--no-pretty", "--no-error-summary", "--no-color-output", "--hide-error-context", "--show-error-codes", "--show-column-numbers"}, args)
return []byte(testMypyOutput), errors.New("mypy always exits with an error when there are messages")
}

Expand All @@ -80,7 +80,7 @@ func TestMypyRun(t *testing.T) {
exec.CommandOutput = func(dir, name string, args ...string) ([]byte, error) {
require.Equal(t, project.Dir, dir)
require.Equal(t, "mypy", name)
require.Equal(t, []string{project.Dir, "--strict", "--no-pretty", "--no-error-summary", "--no-color-output", "--hide-error-context", "--show-error-codes", "--show-column-numbers"}, args)
require.Equal(t, []string{project.Dir, "--exclude", "/(\\.env|\\.venv|env|venv|ENV|env\\.bak|venv\\.bak)/", "--strict", "--no-pretty", "--no-error-summary", "--no-color-output", "--hide-error-context", "--show-error-codes", "--show-column-numbers"}, args)
return []byte(testMypySuccessOutput), nil
}

Expand Down

0 comments on commit 7e2a29d

Please sign in to comment.