From 3e5bcf9b2a3579545c307b59dbf0dfc2de94874f Mon Sep 17 00:00:00 2001
From: Simon Rose <simon.rose@ess.eu>
Date: Mon, 21 Jun 2021 10:44:17 +0200
Subject: [PATCH] Switching to pytest

---
 .gitignore                                      |  5 ++++-
 tests/test_build/Makefile                       | 17 -----------------
 tests/test_build/{wrapper => data}/Makefile     |  0
 .../test_build/{wrapper => data}/build.Makefile |  0
 .../{wrapper => data}/build/database.db         |  0
 .../data/patch/Site/0.0.0+0/apply.p0.patch      |  9 +++++++++
 .../patch/Site/0.0.0-dont-apply.p0.patch        |  0
 .../patch/Site/0.0.0/dont-apply.p0.patch        |  0
 tests/test_build/test_build.py                  | 13 +++++++++++++
 .../wrapper/patch/Site/0.0.0+0/apply.p0.patch   |  9 ---------
 10 files changed, 26 insertions(+), 27 deletions(-)
 delete mode 100644 tests/test_build/Makefile
 rename tests/test_build/{wrapper => data}/Makefile (100%)
 rename tests/test_build/{wrapper => data}/build.Makefile (100%)
 rename tests/test_build/{wrapper => data}/build/database.db (100%)
 create mode 100644 tests/test_build/data/patch/Site/0.0.0+0/apply.p0.patch
 rename tests/test_build/{wrapper => data}/patch/Site/0.0.0-dont-apply.p0.patch (100%)
 rename tests/test_build/{wrapper => data}/patch/Site/0.0.0/dont-apply.p0.patch (100%)
 create mode 100644 tests/test_build/test_build.py
 delete mode 100644 tests/test_build/wrapper/patch/Site/0.0.0+0/apply.p0.patch

diff --git a/.gitignore b/.gitignore
index 73d283f5..36e1a40a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,4 +18,7 @@ tools/ess-env.conf
 .vscode
 require-ess/require.Makefile
 require-ess/Db/*.db
-require-ess/Db/*.d
\ No newline at end of file
+require-ess/Db/*.d
+cellMods
+*.log
+__pycache__
\ No newline at end of file
diff --git a/tests/test_build/Makefile b/tests/test_build/Makefile
deleted file mode 100644
index 9a67252d..00000000
--- a/tests/test_build/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-
-.PHONY: default
-default: test
-
-.PHONY: test
-test: check_env
-	${MAKE} -C wrapper init
-	${MAKE} -C wrapper clean
-	${MAKE} -C wrapper patch
-	${MAKE} -C wrapper cellinstall
-
-.PHONY: check_env
-check_env: guard-EPICS_BASE guard-E3_REQUIRE_VERSION
-	@#$(or $(wildcard ${EPICS_BASE}/require/${E3_REQUIRE_VERSION}/bin/setE3Env.bash), $(error setE3Env.bash not found. Please check your version of base and require.))
-
-guard-%:
-	@#$(or ${$*}, $(error $* is not set))
diff --git a/tests/test_build/wrapper/Makefile b/tests/test_build/data/Makefile
similarity index 100%
rename from tests/test_build/wrapper/Makefile
rename to tests/test_build/data/Makefile
diff --git a/tests/test_build/wrapper/build.Makefile b/tests/test_build/data/build.Makefile
similarity index 100%
rename from tests/test_build/wrapper/build.Makefile
rename to tests/test_build/data/build.Makefile
diff --git a/tests/test_build/wrapper/build/database.db b/tests/test_build/data/build/database.db
similarity index 100%
rename from tests/test_build/wrapper/build/database.db
rename to tests/test_build/data/build/database.db
diff --git a/tests/test_build/data/patch/Site/0.0.0+0/apply.p0.patch b/tests/test_build/data/patch/Site/0.0.0+0/apply.p0.patch
new file mode 100644
index 00000000..4260cef4
--- /dev/null
+++ b/tests/test_build/data/patch/Site/0.0.0+0/apply.p0.patch
@@ -0,0 +1,9 @@
+diff --git database.db database.db
+index 1806ff6..8701832 100644
+--- database.db
++++ database.db
+@@ -1,3 +1,3 @@
+ record(ai, "TEST") {
+-    
++    field(DESC, "OK")
+ }
diff --git a/tests/test_build/wrapper/patch/Site/0.0.0-dont-apply.p0.patch b/tests/test_build/data/patch/Site/0.0.0-dont-apply.p0.patch
similarity index 100%
rename from tests/test_build/wrapper/patch/Site/0.0.0-dont-apply.p0.patch
rename to tests/test_build/data/patch/Site/0.0.0-dont-apply.p0.patch
diff --git a/tests/test_build/wrapper/patch/Site/0.0.0/dont-apply.p0.patch b/tests/test_build/data/patch/Site/0.0.0/dont-apply.p0.patch
similarity index 100%
rename from tests/test_build/wrapper/patch/Site/0.0.0/dont-apply.p0.patch
rename to tests/test_build/data/patch/Site/0.0.0/dont-apply.p0.patch
diff --git a/tests/test_build/test_build.py b/tests/test_build/test_build.py
new file mode 100644
index 00000000..fae0b6e7
--- /dev/null
+++ b/tests/test_build/test_build.py
@@ -0,0 +1,13 @@
+import pytest
+from distutils import dir_util
+
+
+@pytest.fixture
+def e3_wrapper(tmpdir):
+    dir_util.copy_tree("data", str(tmpdir))
+    yield tmpdir
+
+
+def test_patch(e3_wrapper):
+    print(e3_wrapper)
+    assert False
\ No newline at end of file
diff --git a/tests/test_build/wrapper/patch/Site/0.0.0+0/apply.p0.patch b/tests/test_build/wrapper/patch/Site/0.0.0+0/apply.p0.patch
deleted file mode 100644
index 43da836c..00000000
--- a/tests/test_build/wrapper/patch/Site/0.0.0+0/apply.p0.patch
+++ /dev/null
@@ -1,9 +0,0 @@
-diff --git tests/test_build/wrapper/build/database.db tests/test_build/wrapper/build/database.db
-index 1806ff6..8701832 100644
---- tests/test_build/wrapper/build/database.db
-+++ tests/test_build/wrapper/build/database.db
-@@ -1,3 +1,3 @@
- record(ai, "TEST") {
--    
-+    field(DESC, "OK")
- }
-- 
GitLab