parallel_tests 1.3.8 → 1.3.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aa211d03de23d85a2e327d05ef991c59d2cf65ae
4
- data.tar.gz: b602dd6bd2ea580947c37354bdaa3bbe3778fe0c
3
+ metadata.gz: 8126226af76d2ce93824461837f808b5e098af09
4
+ data.tar.gz: 802444bf82a369e183f8aa0b8e5c4c788f659d2e
5
5
  SHA512:
6
- metadata.gz: 73a7d2f7deaf602f442b2b7584c83b58b84568ef22fcbf44205ff17e376521cb760476ac1c3985925693510508a144ba40fdaf57f539afb3773e3bf937019a9c
7
- data.tar.gz: e49cd1e8135afadcdeb6017300e1ae83613e2503b3188b95fd7c450a80d3f14d20796eae4e1d547a40926c6f4a9033acd4930af146d06155374e454e3b9b10aa
6
+ metadata.gz: ec9c6cedfd0c129d4556fd6a44ffeea0d083bc7d1f8dbbdc5e3577b4a0a035bffc33ed7d9df80e3f9284458b590e7dc9e53f10f3ebf5535bf5209e68081cd241
7
+ data.tar.gz: 81e5fa727c44da60db4b81e8ca1ce056a7567625b996351860d7110e2ffb726aa894014be93c170b51e4a1b5adf5d30bfb1a1025b4c1d85296348d671cafcd86
@@ -23,7 +23,7 @@ module ParallelTests
23
23
  Tempfile.open 'parallel_tests-lock' do |lock|
24
24
  return Parallel.map(items, :in_threads => num_processes) do |item|
25
25
  result = yield(item)
26
- report_output(result, lock) if options[:serialize_stdout]
26
+ reprint_output(result, lock.path) if options[:serialize_stdout]
27
27
  result
28
28
  end
29
29
  end
@@ -63,14 +63,25 @@ module ParallelTests
63
63
  end
64
64
  end
65
65
 
66
- def report_output(result, lock)
67
- File.open(lock.path) do |open_lock|
68
- open_lock.flock File::LOCK_EX
66
+ def reprint_output(result, lockfile)
67
+ lock(lockfile) do
69
68
  $stdout.puts result[:stdout]
70
69
  $stdout.flush
71
70
  end
72
71
  end
73
72
 
73
+ def lock(lockfile)
74
+ File.open(lockfile) do |lock|
75
+ begin
76
+ lock.flock File::LOCK_EX
77
+ yield
78
+ ensure
79
+ # This shouldn't be necessary, but appears to be
80
+ lock.flock File::LOCK_UN
81
+ end
82
+ end
83
+ end
84
+
74
85
  def report_results(test_results)
75
86
  results = @runner.find_results(test_results.map { |result| result[:stdout] }*"")
76
87
  puts ""
@@ -1,3 +1,3 @@
1
1
  module ParallelTests
2
- VERSION = Version = '1.3.8'
2
+ VERSION = Version = '1.3.9'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parallel_tests
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.8
4
+ version: 1.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-04 00:00:00.000000000 Z
11
+ date: 2015-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel