diff --git a/Jenkinsfile b/Jenkinsfile index cbd4f12..fb65498 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { } stage("unit tests") { steps { - sh returnStatus: true, script: "python -m pytest --junitxml=unit_tests.xml --cov-report xml:test_coverage.xml --cov=modvcfsamples" + sh returnStatus: true, script: "python -m pytest --junitxml=test_results.xml --cov-report xml:test_coverage.xml --cov=modvcfsamples" xunit checksName: '', tools: [JUnit(excludesPattern: '', pattern: 'test_results.xml', stopProcessingIfError: true)] cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'test_coverage.xml', failUnhealthy: false, failUnstable: false, maxNumberOfBuilds: 64, lineCoverageTargets: '50, 0, 0', methodCoverageTargets: '50, 0, 0', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false } diff --git a/setup.py b/setup.py index fc1f76c..6068493 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,3 @@ from setuptools import setup -setup() \ No newline at end of file +setup() diff --git a/tests/modvcfsamples/test_sample.py b/tests/modvcfsamples/test_sample.py index d579299..2f1002b 100644 --- a/tests/modvcfsamples/test_sample.py +++ b/tests/modvcfsamples/test_sample.py @@ -1,14 +1,24 @@ -from modvcfsamples.sample import keep_specific_call_data, get_records_from_vcf, normalize_gt_to_length +from modvcfsamples.sample import ( + keep_specific_call_data, + get_records_from_vcf, + normalize_gt_to_length, +) import os + def test_filter_all_sample_datatypes_not_empty(): - records, header = get_records_from_vcf(os.path.abspath("tests/resources/test_files_shortened.vcf")) + records, header = get_records_from_vcf( + os.path.abspath("tests/resources/test_files_shortened.vcf") + ) filter_for = ["GT"] modified_records, header = keep_specific_call_data(records, header, *filter_for) assert len(modified_records) == 11 + def test_filter_all_sample_datatypes_filtered(): - records, header = get_records_from_vcf(os.path.abspath("tests/resources/test_files_shortened.vcf")) + records, header = get_records_from_vcf( + os.path.abspath("tests/resources/test_files_shortened.vcf") + ) filter_for = ["GT"] modified_records, header = keep_specific_call_data(records, header, *filter_for) for modified_record in modified_records: @@ -17,14 +27,20 @@ def test_filter_all_sample_datatypes_filtered(): for key, _ in call.data.items(): assert key in filter_for + def test_normalize_gt_to_length_not_empty(): - records, header = get_records_from_vcf(os.path.abspath("tests/resources/test_files_shortened_haploid.vcf")) + records, header = get_records_from_vcf( + os.path.abspath("tests/resources/test_files_shortened_haploid.vcf") + ) modified_records, _ = normalize_gt_to_length(records, header, 4) assert len(modified_records) > 0 + def test_normalize_gt_to_length_gt_normalized(): - records, header = get_records_from_vcf(os.path.abspath("tests/resources/test_files_shortened_haploid.vcf")) + records, header = get_records_from_vcf( + os.path.abspath("tests/resources/test_files_shortened_haploid.vcf") + ) modified_records, _ = normalize_gt_to_length(records, header, 4) for modified_record in modified_records: for call in modified_record.calls: - assert len(call.data["GT"].split("|")) == 4 or "/" in call.data["GT"] \ No newline at end of file + assert len(call.data["GT"].split("|")) == 4 or "/" in call.data["GT"]