From 60707b8f8db38f28b4046c8eaec283f45899dc54 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Mon, 9 Sep 2019 09:55:33 +0200 Subject: [PATCH] Fix cleaning upload files after running tests See https://elixirforum.com/t/running-code-after-all-exunit-tests-are-done/9937/6 Signed-off-by: Thomas Citharel --- mix.exs | 8 ++++++-- script/clean_after_tests | 3 --- 2 files changed, 6 insertions(+), 5 deletions(-) delete mode 100755 script/clean_after_tests diff --git a/mix.exs b/mix.exs index 1435bc9d9..aa18d53c0 100644 --- a/mix.exs +++ b/mix.exs @@ -132,8 +132,7 @@ defmodule Mobilizon.Mixfile do test: [ "ecto.create --quiet", "ecto.migrate", - "test", - "cmd ./script/clean_after_tests" + &run_test/1 ], "phx.deps_migrate_serve": [ "deps.get", @@ -145,6 +144,11 @@ defmodule Mobilizon.Mixfile do ] end + defp run_test(args) do + Mix.Task.run("test", args) + File.rm_rf!("test/uploads") + end + defp docs() do [ source_ref: "v#{@version}", diff --git a/script/clean_after_tests b/script/clean_after_tests deleted file mode 100755 index 7344216e4..000000000 --- a/script/clean_after_tests +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -rm -rf test/uploads