Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
chipseq_analysis
Manage
Activity
Members
Labels
Plan
Issues
19
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
3
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
BICF
Astrocyte
chipseq_analysis
Commits
6b2c56dc
Commit
6b2c56dc
authored
7 years ago
by
Venkat Malladi
Browse files
Options
Downloads
Patches
Plain Diff
Add in test for utils.
parent
577d7b85
1 merge request
!5
Resolve "Add mapping and trimming"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
workflow/tests/test_utils.py
+53
-0
53 additions, 0 deletions
workflow/tests/test_utils.py
with
53 additions
and
0 deletions
workflow/tests/test_utils.py
0 → 100644
+
53
−
0
View file @
6b2c56dc
#!/usr/bin/env python3
import
pytest
import
shutil
import
shlex
import
utils
@pytest.fixture
def
steps
():
steps
=
[]
return
steps
@pytest.fixture
def
steps_1
(
steps
):
design_file
=
"
test_data/design_ENCSR238SGC_SE.txt
"
step
=
[
"
grep H3K4me1 %s
"
%
(
design_file
)]
return
step
@pytest.fixture
def
steps_2
(
steps_1
):
steps_1
.
extend
([
"
cut -f7
"
])
return
steps_1
def
test_run_one_step
(
steps_1
,
capsys
):
check_output
=
'
ENCSR238SGC
\t
limb
\t
H3K4me1
\t
None
\t
1
\t
ENCSR687ALB
\t
ENCFF833BLU.fastq.gz
'
.
encode
(
'
UTF-8
'
)
out
,
err
=
utils
.
run_pipe
(
steps_1
)
output
,
errors
=
capsys
.
readouterr
()
assert
"
first step shlex to stdout
"
in
output
assert
check_output
in
out
def
test_run_two_step
(
steps_2
,
capsys
):
check_output
=
'
ENCFF833BLU.fastq.gz
\n
ENCFF646LXU.fastq.gz
'
.
encode
(
'
UTF-8
'
)
out
,
err
=
utils
.
run_pipe
(
steps_2
)
output
,
errors
=
capsys
.
readouterr
()
assert
"
intermediate step 2 shlex to stdout
"
in
output
assert
check_output
in
out
def
test_run_last_step_file
(
steps_2
,
capsys
,
tmpdir
):
check_output
=
'
ENCFF833BLU.fastq.gz
\n
ENCFF646LXU.fastq.gz
'
tmp_outfile
=
tmpdir
.
join
(
'
output.txt
'
)
out
,
err
=
utils
.
run_pipe
(
steps_2
,
tmp_outfile
.
strpath
)
output
,
errors
=
capsys
.
readouterr
()
assert
"
last step shlex
"
in
output
assert
check_output
in
tmp_outfile
.
read
()
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment