
This will allow us to have global setup and teardown for tests. For example, we can automatically clear caches after each test, to avoid annoying intermittent failures like #1879 and #1886.
25 lines
495 B
Ruby
25 lines
495 B
Ruby
require "testing_env"
|
|
require "formula_lock"
|
|
|
|
class FormulaLockTests < Homebrew::TestCase
|
|
def setup
|
|
super
|
|
@lock = FormulaLock.new("foo")
|
|
@lock.lock
|
|
end
|
|
|
|
def teardown
|
|
@lock.unlock
|
|
HOMEBREW_LOCK_DIR.children.each(&:unlink)
|
|
super
|
|
end
|
|
|
|
def test_locking_file_with_existing_lock_raises_error
|
|
assert_raises(OperationInProgressError) { FormulaLock.new("foo").lock }
|
|
end
|
|
|
|
def test_locking_existing_lock_suceeds
|
|
assert_nothing_raised { @lock.lock }
|
|
end
|
|
end
|