aboutsummaryrefslogtreecommitdiff
path: root/wqflask/tests/unit
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-09-19 09:58:37 +0300
committerFrederick Muriuki Muriithi2022-09-19 09:58:37 +0300
commit7785049a64dc3f1b2d9d07a31f43b8cc5527214b (patch)
treecfd6e133620740945a7b60d45d8603d5c2dfceed /wqflask/tests/unit
parente1b7c18b3d42600746f03ade29030e8a14c7ea1d (diff)
downloadgenenetwork2-7785049a64dc3f1b2d9d07a31f43b8cc5527214b.tar.gz
Provide fixtures for test. Fix error to pass test.
Provide the following (empty) files to be used for the test * wqflask/tests/unit/wqflask/marker_regression/genotype/bimbam/file_geno.txt * wqflask/tests/unit/wqflask/marker_regression/genotype/bimbam/file_snps.txt Rework the paths in `wqflask/tests/unit/wqflask/marker_regression/test_gemma_mapping.py` such that they point to the files added above for testing. Do not require that the phenotype file exists in `wqflask/wqflask/marker_regression/gemma_mapping.py` before attempting the mapping.
Diffstat (limited to 'wqflask/tests/unit')
-rw-r--r--wqflask/tests/unit/wqflask/marker_regression/genotype/bimbam/file_geno.txt0
-rw-r--r--wqflask/tests/unit/wqflask/marker_regression/genotype/bimbam/file_snps.txt0
-rw-r--r--wqflask/tests/unit/wqflask/marker_regression/test_gemma_mapping.py7
3 files changed, 5 insertions, 2 deletions
diff --git a/wqflask/tests/unit/wqflask/marker_regression/genotype/bimbam/file_geno.txt b/wqflask/tests/unit/wqflask/marker_regression/genotype/bimbam/file_geno.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/wqflask/tests/unit/wqflask/marker_regression/genotype/bimbam/file_geno.txt
diff --git a/wqflask/tests/unit/wqflask/marker_regression/genotype/bimbam/file_snps.txt b/wqflask/tests/unit/wqflask/marker_regression/genotype/bimbam/file_snps.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/wqflask/tests/unit/wqflask/marker_regression/genotype/bimbam/file_snps.txt
diff --git a/wqflask/tests/unit/wqflask/marker_regression/test_gemma_mapping.py b/wqflask/tests/unit/wqflask/marker_regression/test_gemma_mapping.py
index 43051828..24400b33 100644
--- a/wqflask/tests/unit/wqflask/marker_regression/test_gemma_mapping.py
+++ b/wqflask/tests/unit/wqflask/marker_regression/test_gemma_mapping.py
@@ -1,4 +1,5 @@
# test for wqflask/marker_regression/gemma_mapping.py
+import os
import unittest
import random
from unittest import mock
@@ -40,7 +41,8 @@ class TestGemmaMapping(unittest.TestCase):
@mock.patch("wqflask.marker_regression.gemma_mapping.webqtlConfig.GENERATED_IMAGE_DIR", "/home/user/img")
@mock.patch("wqflask.marker_regression.gemma_mapping.GEMMAOPTS", "-debug")
@mock.patch("wqflask.marker_regression.gemma_mapping.GEMMA_WRAPPER_COMMAND", "ghc")
- @mock.patch("wqflask.marker_regression.gemma_mapping.TEMPDIR", "/home/user/data/")
+ @mock.patch("wqflask.marker_regression.gemma_mapping.TEMPDIR",
+ os.path.join(os.path.dirname(__file__), "user/data"))
@mock.patch("wqflask.marker_regression.gemma_mapping.parse_loco_output")
@mock.patch("wqflask.marker_regression.gemma_mapping.flat_files")
@mock.patch("wqflask.marker_regression.gemma_mapping.gen_covariates_file")
@@ -64,7 +66,8 @@ class TestGemmaMapping(unittest.TestCase):
mock_os.path.isfile.return_value = True
mock_gen_covar.return_value = None
mock_choice.return_value = "R"
- mock_flat_files.return_value = "/home/genotype/bimbam"
+ mock_flat_files.return_value = os.path.join(
+ os.path.dirname(__file__), "genotype/bimbam")
mock_parse_loco.return_value = []
results = run_gemma(this_trait=trait, this_dataset=dataset, samples=[
], vals=[], covariates="", use_loco=True)