generated from ydeng/python-program
	Updated pipeline and formatted code
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				ydeng/modvcfsamples/pipeline/head This commit looks good
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	ydeng/modvcfsamples/pipeline/head This commit looks good
				
			Pipeline now looks for correct unit test file
This commit is contained in:
		
							
								
								
									
										2
									
								
								Jenkinsfile
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								Jenkinsfile
									
									
									
									
										vendored
									
									
								
							| @@ -9,7 +9,7 @@ pipeline { | |||||||
|         } |         } | ||||||
|         stage("unit tests") { |         stage("unit tests") { | ||||||
|             steps { |             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)] |                 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 |                 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 | ||||||
|             } |             } | ||||||
|   | |||||||
| @@ -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 | import os | ||||||
|  |  | ||||||
|  |  | ||||||
| def test_filter_all_sample_datatypes_not_empty(): | 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"] |     filter_for = ["GT"] | ||||||
|     modified_records, header = keep_specific_call_data(records, header, *filter_for) |     modified_records, header = keep_specific_call_data(records, header, *filter_for) | ||||||
|     assert len(modified_records) == 11 |     assert len(modified_records) == 11 | ||||||
|  |  | ||||||
|  |  | ||||||
| def test_filter_all_sample_datatypes_filtered(): | 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"] |     filter_for = ["GT"] | ||||||
|     modified_records, header = keep_specific_call_data(records, header, *filter_for) |     modified_records, header = keep_specific_call_data(records, header, *filter_for) | ||||||
|     for modified_record in modified_records: |     for modified_record in modified_records: | ||||||
| @@ -17,13 +27,19 @@ def test_filter_all_sample_datatypes_filtered(): | |||||||
|             for key, _ in call.data.items(): |             for key, _ in call.data.items(): | ||||||
|                 assert key in filter_for |                 assert key in filter_for | ||||||
|  |  | ||||||
|  |  | ||||||
| def test_normalize_gt_to_length_not_empty(): | 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) |     modified_records, _ = normalize_gt_to_length(records, header, 4) | ||||||
|     assert len(modified_records) > 0 |     assert len(modified_records) > 0 | ||||||
|  |  | ||||||
|  |  | ||||||
| def test_normalize_gt_to_length_gt_normalized(): | 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) |     modified_records, _ = normalize_gt_to_length(records, header, 4) | ||||||
|     for modified_record in modified_records: |     for modified_record in modified_records: | ||||||
|         for call in modified_record.calls: |         for call in modified_record.calls: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user