From 7785049a64dc3f1b2d9d07a31f43b8cc5527214b Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 19 Sep 2022 09:58:37 +0300 Subject: 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. --- .../unit/wqflask/marker_regression/genotype/bimbam/file_geno.txt | 0 .../unit/wqflask/marker_regression/genotype/bimbam/file_snps.txt | 0 wqflask/tests/unit/wqflask/marker_regression/test_gemma_mapping.py | 7 +++++-- 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 wqflask/tests/unit/wqflask/marker_regression/genotype/bimbam/file_geno.txt create mode 100644 wqflask/tests/unit/wqflask/marker_regression/genotype/bimbam/file_snps.txt (limited to 'wqflask/tests') 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 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 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) -- cgit v1.2.3