Skip to content

Commit

Permalink
Merge pull request #5 from VitalConnectInc/pull-44
Browse files Browse the repository at this point in the history
Add `--nice` flag
  • Loading branch information
pboling authored Jan 14, 2025
2 parents 07e03ff + 28829a1 commit 4d3d0b3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
14 changes: 7 additions & 7 deletions .rubocop_gradual.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
"lib/turbo_tests/reporter.rb:1386902608": [
[7, 5, 400, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2092085575]
],
"lib/turbo_tests/runner.rb:1170052458": [
"lib/turbo_tests/runner.rb:1092969829": [
[13, 5, 271, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 21989008],
[20, 5, 1253, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1925027850],
[211, 11, 10, "ThreadSafety/NewThread: Avoid starting new threads.", 3411682361],
[229, 47, 6, "Style/GlobalStdStream: Use `$stderr` instead of `STDERR`.", 3356712163],
[231, 21, 10, "ThreadSafety/NewThread: Avoid starting new threads.", 3411682361],
[240, 7, 10, "ThreadSafety/NewThread: Avoid starting new threads.", 3411682361],
[300, 9, 6, "Style/GlobalStdStream: Use `$stdout` instead of `STDOUT`.", 3356722952]
[20, 5, 1311, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1925027850],
[216, 11, 10, "ThreadSafety/NewThread: Avoid starting new threads.", 3411682361],
[234, 47, 6, "Style/GlobalStdStream: Use `$stderr` instead of `STDERR`.", 3356712163],
[236, 21, 10, "ThreadSafety/NewThread: Avoid starting new threads.", 3411682361],
[245, 7, 10, "ThreadSafety/NewThread: Avoid starting new threads.", 3411682361],
[305, 9, 6, "Style/GlobalStdStream: Use `$stdout` instead of `STDOUT`.", 3356722952]
],
"spec/cli_spec.rb:3990998076": [
[1, 1, 30, "RSpec/SpecFilePathFormat: Spec path should end with `turbo_tests/cli*_spec.rb`.", 965721356],
Expand Down
6 changes: 6 additions & 0 deletions lib/turbo_tests/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def run
seed = nil
print_failed_group = false
create = false
nice = false

OptionParser.new do |opts|
opts.banner = <<~BANNER
Expand Down Expand Up @@ -95,6 +96,10 @@ def run
opts.on("--print_failed_group", "Prints group that had failures in it") do
print_failed_group = true
end

opts.on("--nice", "execute test commands with low priority") do
nice = true
end
end.parse!(@argv)

if create
Expand Down Expand Up @@ -126,6 +131,7 @@ def run
fail_fast: fail_fast,
count: count,
seed: seed,
nice: nice,
print_failed_group: print_failed_group,
parallel_options: parallel_options,
)
Expand Down
5 changes: 5 additions & 0 deletions lib/turbo_tests/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def self.run(opts = {})
seed = opts.fetch(:seed, nil)
seed_used = !seed.nil?
print_failed_group = opts.fetch(:print_failed_group, false)
nice = opts.fetch(:nice, false)

use_runtime_info = files == ["spec"]

Expand All @@ -57,6 +58,7 @@ def self.run(opts = {})
print_failed_group: print_failed_group,
use_runtime_info: use_runtime_info,
parallel_options: parallel_options,
nice: nice,
).run
end

Expand All @@ -69,6 +71,7 @@ def initialize(opts)
@count = opts[:count]
@seed = opts[:seed]
@seed_used = opts[:seed_used]
@nice = opts[:nice]
@use_runtime_info = opts[:use_runtime_info]

@load_time = 0
Expand Down Expand Up @@ -194,6 +197,8 @@ def start_subprocess(env, extra_args, tests, process_id, record_runtime:)
*record_runtime_options,
*tests,
]
command.unshift(ENV["BUNDLE_BIN_PATH"], "exec") if ENV["BUNDLE_BIN_PATH"]
command.unshift("nice") if @nice

if @verbose
command_str = [
Expand Down

0 comments on commit 4d3d0b3

Please sign in to comment.