File: test_synplot.py

package info (click to toggle)
python-pauvre 0.2.3-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 616 kB
  • sloc: python: 3,947; sh: 44; makefile: 20
file content (66 lines) | stat: -rw-r--r-- 2,845 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# pauvre - just a pore plotting package
# Copyright (c) 2016-2018 Darrin T. Schultz. All rights reserved.
#
# This file is part of pauvre.
#
# pauvre is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pauvre is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pauvre.  If not, see <http://www.gnu.org/licenses/>.

import os
import subprocess as sp
import unittest

class libSeq_test_case(unittest.TestCase):
    """Tests that different features of synplot work correctly
    """
    def setUp(self):
        # Here we must safely make the test directory if it does
        #  not exist
        scriptdir = os.path.dirname(os.path.realpath(__file__))
        testoutputdir = os.path.join(scriptdir, "testresults")
        if not os.path.exists(testoutputdir):
            os.makedirs(testoutputdir)
            # now we see if the specific subdirectory for the program
            #  we are testing exists
        self.thisoutdir = os.path.join(testoutputdir, "synplot")
        if not os.path.exists(self.thisoutdir):
            os.makedirs(self.thisoutdir)
            # now we change our working directory to the
            #  specific subdirectory for this file

        self.aln_dir = os.path.join(scriptdir, "testdata/alignments/")
        self.gff1 = os.path.join(scriptdir, "testdata/gff_files/Bf201706.gff")
        self.gff2 = os.path.join(scriptdir, "testdata/gff_files/JN392469.gff")
        self.gff3 = os.path.join(scriptdir, "testdata/gff_files/NC016117.gff")


    def test_normal_plotting_scenario(self):
        """This verifies that the LibSeq class is constructed with all of the
        parameters that are present in the meraculous config files"""
        os.chdir(self.thisoutdir)
        thiscommand =    """pauvre synplot --aln_dir {0} \
                         --fileform pdf \
                         --gff_paths {1} {2} {3} \
                         --center_on COX1 \
                         --gff_labels "B. forskalii" "P. bachei" "M. leidyi" """.format(
                             self.aln_dir, self.gff1,
                             self.gff2, self.gff3)

        data = sp.Popen(thiscommand, shell = True,
                        stdout=sp.PIPE)
        print("The data is:", data.communicate()[0].decode())
        print("The return code is: ", data.returncode)
        self.assertEqual(0, int(data.returncode))