comparison test/test_query_mass_repos.py @ 0:dffc38727496

initial commit
author pieter.lukasse@wur.nl
date Sat, 07 Feb 2015 22:02:00 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:dffc38727496
1 '''Integration tests for the GCMS project'''
2
3 from pkg_resources import resource_filename # @UnresolvedImport # pylint: disable=E0611
4 from MS import query_mass_repos
5 import os.path
6 import sys
7 import unittest
8
9
10 class IntegrationTest(unittest.TestCase):
11
12
13
14
15 def test_simple(self):
16 '''
17 Simple initial test
18 '''
19 # Create out folder
20 outdir = "output/query_mass_repos/"
21 if not os.path.exists(outdir):
22 os.makedirs(outdir)
23
24 #Build up arguments and run
25
26 # input_file = sys.argv[1]
27 # molecular_mass_col = sys.argv[2]
28 # repository_file = sys.argv[3]
29 # mass_tolerance = float(sys.argv[4])
30 # output_result = sys.argv[5]
31
32 input_file = resource_filename(__name__, "data/service_query_tabular.txt")
33
34 molecular_mass_col = "mass (Da)"
35 dblink_file = resource_filename(__name__, "data/MFSearcher ExactMassDB service.txt")
36 output_result = resource_filename(__name__, outdir + "metexp_query_results_added.txt")
37
38
39
40
41 sys.argv = ['test',
42 input_file,
43 molecular_mass_col,
44 dblink_file,
45 '0.001',
46 'ms',
47 output_result]
48
49 # Execute main function with arguments provided through sys.argv
50 query_mass_repos.main()
51
52
53
54
55
56 def _read_file(filename):
57 '''
58 Helper method to quickly read a file
59 @param filename:
60 '''
61 with open(filename) as handle:
62 return handle.read()