Skip to content

Commit f670222

Browse files
committed
Reset tags for every test
1 parent febee82 commit f670222

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

lib/ex_unit/lib/ex_unit/case.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ defmodule ExUnit.Case do
245245
|> Keyword.put(:line, env.line)
246246
Module.put_attribute(env.module, :ex_unit_tests,
247247
ExUnit.Test[name: name, case: env.module, tags: tags])
248+
Module.delete_attribute(env.module, :tag)
248249
end
249250
end
250251

lib/ex_unit/lib/ex_unit/runner.ex

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,6 @@ defmodule ExUnit.Runner do
149149
end
150150

151151
defp spawn_test(_config, test, context) do
152-
case_name = test.case
153-
154152
# Run test in a new process so that we can trap exits for a single test
155153
self_pid = self
156154
{ test_pid, test_ref } = Process.spawn_monitor(fn ->

lib/ex_unit/test/ex_unit/case_test.exs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,9 @@ defmodule ExUnit.CaseTest do
2020
assert context[:hello] == true
2121
assert context[:world] == :good
2222
end
23+
24+
test "reset tags", context do
25+
assert nil?(context[:hello])
26+
assert nil?(context[:world])
27+
end
2328
end

0 commit comments

Comments
 (0)