summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2016-01-14 00:41:02 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2016-01-14 01:12:49 +0900
commitedb647667e5630c77515e99a66bccec9d7519c0e (patch)
tree55e8d80d054272eb23f1cc878fe89df5a281faff /test
parent8d3a302a1754a4e28cc1085b95e9a03981372d02 (diff)
Change temporary file names to fix flaky tests
Diffstat (limited to 'test')
-rw-r--r--test/test_go.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/test_go.rb b/test/test_go.rb
index 85e3d838..a049a153 100644
--- a/test/test_go.rb
+++ b/test/test_go.rb
@@ -143,8 +143,10 @@ class TestBase < Minitest::Test
attr_reader :tmux
def tempname
+ @temp_suffix ||= 0
[TEMPNAME,
- caller_locations.map(&:label).find { |l| l =~ /^test_/ }].join '-'
+ caller_locations.map(&:label).find { |l| l =~ /^test_/ },
+ @temp_suffix].join '-'
end
def setup
@@ -158,6 +160,7 @@ class TestBase < Minitest::Test
File.read(tempname)
ensure
File.unlink tempname while File.exists?(tempname)
+ @temp_suffix += 1
tmux.prepare
end