Mercurial > repos > rhpvorderman > shm_csr
diff tests/test_shm_csr.py @ 3:dced6d52d218 draft
"planemo upload commit bdfa4424496371fbea3edd3de07d8be9d0bad432"
| author | rhpvorderman |
|---|---|
| date | Mon, 15 Nov 2021 11:35:18 +0000 |
| parents | 64d74ba01a7c |
| children | 495a521cf9f2 |
line wrap: on
line diff
--- a/tests/test_shm_csr.py Fri Nov 05 14:43:13 2021 +0000 +++ b/tests/test_shm_csr.py Mon Nov 15 11:35:18 2021 +0000 @@ -36,11 +36,17 @@ @pytest.fixture(scope="module") def shm_csr_result(): - temp_dir = tempfile.mktemp() - shutil.copytree(GIT_ROOT, temp_dir) + temp_dir = Path(tempfile.mkdtemp()) + tool_dir = temp_dir / "shm_csr" + shutil.copytree(GIT_ROOT, tool_dir) + working_dir = temp_dir / "working" + working_dir.mkdir(parents=True) + output_dir = temp_dir / "outputs" + output_dir.mkdir(parents=True) + wrapper = str(tool_dir / "wrapper.sh") input = str(CONTROL_NWK377_PB_IGHC_MID1_40nt_2) - out_files_path = os.path.join(temp_dir, "results") - out_file = os.path.join(out_files_path, "result.html") + out_files_path = output_dir / "results" + out_file = out_files_path / "result.html" infile_name = "input_data" functionality = "productive" unique = "Sequence.ID" @@ -57,11 +63,11 @@ fast = 'no' cmd = [ "bash", - "wrapper.sh", + wrapper, input, "custom", - out_file, - out_files_path, + str(out_file), + str(out_files_path), infile_name, "-", functionality, @@ -78,8 +84,10 @@ empty_region_filter, fast ] - subprocess.run(cmd, cwd=temp_dir, stdout=sys.stdout, stderr=sys.stderr, - check=True) + with open(temp_dir / "stderr", "wt") as stderr_file: + with open(temp_dir / "stdout", "wt") as stdout_file: + subprocess.run(cmd, cwd=working_dir, stdout=stdout_file, + stderr=stderr_file, check=True) yield Path(out_files_path) #shutil.rmtree(temp_dir)
