Esempio n. 1
0
    def setUpClass(cls):

        if os.path.isfile('ODKFiles/odkBCExportNew.csv'):
            os.remove('ODKFiles/odkBCExportNew.csv')
        if os.path.isfile('ODKFiles/odkBCExportPrev.csv'):
            os.remove('ODKFiles/odkBCExportPrev.csv')
        shutil.copy('ODKFiles/odkExport_phmrc-1.csv',
                    'ODKFiles/odkBCExportPrev.csv')
        shutil.copy('ODKFiles/odkExport_phmrc-2.csv',
                    'ODKFiles/odkBCExportNew.csv')
        if not os.path.isfile('smartva'):
            downloadSmartVA()
        if not os.path.isfile('Pipeline.db'):
            createTransferDB('Pipeline.db', '.', 'enilepiP')

        # pipelineRunDate = datetime.datetime.now()
        pipelineRunDate = datetime.datetime(2018, 9, 1, 9, 0, 0). \
                            strftime('%Y_%m_%d_%H:%M:%S')
        xferDB = TransferDB(dbFileName = 'copy_Pipeline.db',
                            dbDirectory = '.',
                            dbKey = 'enilepiP',
                            plRunDate = pipelineRunDate)
        conn = xferDB.connectDB()
        c = conn.cursor()
        sql = 'UPDATE Pipeline_Conf SET algorithm = ?, algorithmMetadataCode = ?'
        par = ('SmartVA', 'SmartVA|2.0.0_a8|PHMRCShort|1|PHMRCShort|1')
        c.execute(sql, par)
        settingsPipeline = xferDB.configPipeline(conn)
        settingsODK = xferDB.configODK(conn)
        settingsSmartVA = xferDB.configOpenVA(conn,
                                              'SmartVA',
                                              settingsPipeline.workingDirectory)
        conn.rollback()
        conn.close()
        cls.staticRunDate = datetime.datetime(2018, 9, 1, 9, 0, 0). \
                            strftime('%Y_%m_%d_%H:%M:%S')
        shutil.rmtree(
            os.path.join('OpenVAFiles', cls.staticRunDate),
            ignore_errors = True
        )
        cliSmartVA = OpenVA(vaArgs = settingsSmartVA,
                            pipelineArgs = settingsPipeline,
                            odkID = settingsODK.odkID,
                            runDate = cls.staticRunDate)
        zeroRecords = cliSmartVA.copyVA()
        cls.completed = cliSmartVA.getCOD()
        cls.svaOut = os.path.join(
            'OpenVAFiles',
            cls.staticRunDate,
            '1-individual-cause-of-death/individual-cause-of-death.csv'
        )
Esempio n. 2
0
    def setUpClass(cls):

        if os.path.isfile('ODKFiles/odkBCExportNew.csv'):
            os.remove('ODKFiles/odkBCExportNew.csv')
        if os.path.isfile('ODKFiles/odkBCExportPrev.csv'):
            os.remove('ODKFiles/odkBCExportPrev.csv')
        shutil.copy('ODKFiles/previous_bc_export.csv',
                    'ODKFiles/odkBCExportPrev.csv')
        shutil.copy('ODKFiles/another_bc_export.csv',
                    'ODKFiles/odkBCExportNew.csv')
        if os.path.isfile('Check_InSilicoVA_Pipeline.db'):
            os.remove('Check_InSilicoVA_Pipeline.db')
        createTransferDB('Check_InSilicoVA_Pipeline.db', '.', 'enilepiP')

        # pipelineRunDate = datetime.datetime.now()
        pipelineRunDate = datetime.datetime(2018, 9, 1, 9, 0, 0). \
                            strftime('%Y_%m_%d_%H:%M:%S')
        xferDB = TransferDB(dbFileName = 'Check_InSilicoVA_Pipeline.db',
                            dbDirectory = '.',
                            dbKey = 'enilepiP',
                            plRunDate = pipelineRunDate)
        conn = xferDB.connectDB()
        c = conn.cursor()
        sql = 'UPDATE Pipeline_Conf SET algorithm = ?, algorithmMetadataCode = ?'
        par = ('InSilicoVA', 'InSilicoVA-2016|1.0.0|InterVA|5|2016 WHO Verbal Autopsy Form|v1_4_1')
        c.execute(sql, par)
        sql = 'UPDATE InSilicoVA_Conf SET data_type = ?'
        par = ('WHO2016',)
        c.execute(sql, par)
        settingsPipeline = xferDB.configPipeline(conn)
        settingsODK = xferDB.configODK(conn)
        settingsInSilicoVA = xferDB.configOpenVA(conn,
                                                 'InSilicoVA',
                                                 settingsPipeline.workingDirectory)
        # conn.rollback()
        conn.close()
        cls.staticRunDate = datetime.datetime(2018, 9, 1, 9, 0, 0). \
                            strftime('%Y_%m_%d_%H:%M:%S')
 
        cls.rScript = os.path.join('OpenVAFiles', cls.staticRunDate,
                                   'Rscript_' + cls.staticRunDate + '.R')
        cls.rOutFile = os.path.join('OpenVAFiles', cls.staticRunDate,
                                    'Rscript_' + cls.staticRunDate + '.Rout')
        rOpenVA = OpenVA(vaArgs = settingsInSilicoVA,
                         pipelineArgs = settingsPipeline,
                         odkID = settingsODK.odkID,
                         runDate = cls.staticRunDate)
        zeroRecords = rOpenVA.copyVA()
        rOpenVA.rScript()
        cls.completed = rOpenVA.getCOD()
Esempio n. 3
0
    def test_3_getCOD_interva(self):
        """Check that getCOD() executes R script for interva"""
        c = self.conn.cursor()
        sql = "UPDATE Pipeline_Conf SET algorithm = ?, algorithmMetadataCode = ?"
        par = ("InterVA",
               "InterVA4|4.04|Custom|1|2016 WHO Verbal Autopsy Form|v1_4_1")
        c.execute(sql, par)
        settingsPipeline = self.xferDB.configPipeline(self.conn)
        settingsODK = self.xferDB.configODK(self.conn)
        settingsInterVA = self.xferDB.configOpenVA(
            self.conn, "InterVA", settingsPipeline.workingDirectory)
        self.conn.rollback()
        dirOpenVA = os.path.join(settingsPipeline.workingDirectory,
                                 "OpenVAFiles")
        dirODK = os.path.join(settingsPipeline.workingDirectory, "ODKFiles")
        staticRunDate = datetime.datetime(2018, 9, 1, 9, 0, 0). \
                        strftime("%Y_%m_%d_%H:%M:%S")
        rOutFile = os.path.join(dirOpenVA, staticRunDate,
                                "Rscript_" + staticRunDate + ".Rout")
        shutil.rmtree(os.path.join(dirOpenVA, staticRunDate),
                      ignore_errors=True)
        rOpenVA = OpenVA(vaArgs=settingsInterVA,
                         pipelineArgs=settingsPipeline,
                         odkID=settingsODK.odkID,
                         runDate=staticRunDate)

        if os.path.isfile(dirODK + "/odkBCExportNew.csv"):
            os.remove(dirODK + "/odkBCExportNew.csv")
        if os.path.isfile(dirODK + "/odkBCExportPrev.csv"):
            os.remove(dirODK + "/odkBCExportPrev.csv")
        shutil.copy(dirODK + "/previous_bc_export.csv",
                    dirODK + "/odkBCExportPrev.csv")
        shutil.copy(dirODK + "/another_bc_export.csv",
                    dirODK + "/odkBCExportNew.csv")

        zeroRecords = rOpenVA.copyVA()
        rOpenVA.rScript()
        rOpenVA.getCOD()

        self.assertTrue(os.path.isfile(rOutFile))
        shutil.rmtree(os.path.join(dirOpenVA, staticRunDate),
                      ignore_errors=True)
Esempio n. 4
0
    def test_3_getCOD_smartva_exception(self):
        """getCOD() should raise an exception with faulty args for smartva cli"""
        c = self.conn.cursor()
        sql = "UPDATE Pipeline_Conf SET algorithm = ?, algorithmMetadataCode = ?"
        par = ("SmartVA", "SmartVA|2.0.0_a8|PHMRCShort|1|PHMRCShort|1")
        c.execute(sql, par)
        settingsPipeline = self.xferDB.configPipeline(self.conn)
        settingsODK = self.xferDB.configODK(self.conn)
        self.conn.rollback()
        ntSmartVA = collections.namedtuple("ntSmartVA", [
            "SmartVA_country", "SmartVA_hiv", "SmartVA_malaria", "SmartVA_hce",
            "SmartVA_freetext", "SmartVA_figures", "SmartVA_language"
        ])
        settingsSmartVA = ntSmartVA("Unknown", "Wrong", "Wrong", "Wrong",
                                    "Wrong", "Wrong", "Wrong")
        dirOpenVA = os.path.join(settingsPipeline.workingDirectory,
                                 "OpenVAFiles")
        dirODK = os.path.join(settingsPipeline.workingDirectory, "ODKFiles")
        staticRunDate = datetime.datetime(2018, 9, 1, 9, 0, 0). \
                        strftime("%Y_%m_%d_%H:%M:%S")
        shutil.rmtree(os.path.join(dirOpenVA, staticRunDate),
                      ignore_errors=True)
        if os.path.isfile(dirODK + "/odkBCExportNew.csv"):
            os.remove(dirODK + "/odkBCExportNew.csv")
        if os.path.isfile(dirODK + "/odkBCExportPrev.csv"):
            os.remove(dirODK + "/odkBCExportPrev.csv")
        shutil.copy(dirODK + "/previous_bc_export.csv",
                    dirODK + "/odkBCExportPrev.csv")
        shutil.copy(dirODK + "/another_bc_export.csv",
                    dirODK + "/odkBCExportNew.csv")

        cliSmartVA = OpenVA(vaArgs=settingsSmartVA,
                            pipelineArgs=settingsPipeline,
                            odkID=settingsODK.odkID,
                            runDate=staticRunDate)

        zeroRecords = cliSmartVA.copyVA()

        self.assertRaises(SmartVAError, cliSmartVA.getCOD)
        shutil.rmtree(os.path.join(dirOpenVA, staticRunDate),
                      ignore_errors=True)
Esempio n. 5
0
    def test_3_getCOD_smartva(self):
        """Check that getCOD() executes smartva cli"""
        c = self.conn.cursor()
        sql = "UPDATE Pipeline_Conf SET algorithm = ?, algorithmMetadataCode = ?"
        par = ("SmartVA", "SmartVA|2.0.0_a8|PHMRCShort|1|PHMRCShort|1")
        c.execute(sql, par)
        settingsPipeline = self.xferDB.configPipeline(self.conn)
        settingsODK = self.xferDB.configODK(self.conn)
        settingsSmartVA = self.xferDB.configOpenVA(
            self.conn, "SmartVA", settingsPipeline.workingDirectory)
        self.conn.rollback()
        dirOpenVA = os.path.join(settingsPipeline.workingDirectory,
                                 "OpenVAFiles")
        dirODK = os.path.join(settingsPipeline.workingDirectory, "ODKFiles")
        staticRunDate = datetime.datetime(2018, 9, 1, 9, 0, 0). \
                        strftime("%Y_%m_%d_%H:%M:%S")
        shutil.rmtree(os.path.join(dirOpenVA, staticRunDate),
                      ignore_errors=True)
        if os.path.isfile(dirODK + "/odkBCExportNew.csv"):
            os.remove(dirODK + "/odkBCExportNew.csv")
        if os.path.isfile(dirODK + "/odkBCExportPrev.csv"):
            os.remove(dirODK + "/odkBCExportPrev.csv")
        shutil.copy(dirODK + "/odkExport_phmrc-1.csv",
                    dirODK + "/odkBCExportPrev.csv")
        shutil.copy(dirODK + "/odkExport_phmrc-2.csv",
                    dirODK + "/odkBCExportNew.csv")

        cliSmartVA = OpenVA(vaArgs=settingsSmartVA,
                            pipelineArgs=settingsPipeline,
                            odkID=settingsODK.odkID,
                            runDate=staticRunDate)

        zeroRecords = cliSmartVA.copyVA()
        completed = cliSmartVA.getCOD()
        svaOut = os.path.join(
            dirOpenVA, staticRunDate,
            "1-individual-cause-of-death/individual-cause-of-death.csv")

        self.assertTrue(os.path.isfile(svaOut))
        shutil.rmtree(os.path.join(dirOpenVA, staticRunDate),
                      ignore_errors=True)
Esempio n. 6
0
    def setUpClass(cls):

        if os.path.isfile('ODKFiles/odkBCExportNew.csv'):
            os.remove('ODKFiles/odkBCExportNew.csv')
        if os.path.isfile('ODKFiles/odkBCExportPrev.csv'):
            os.remove('ODKFiles/odkBCExportPrev.csv')
        shutil.copy('ODKFiles/zeroRecords_bc_export.csv',
                    'ODKFiles/odkBCExportPrev.csv')
        shutil.copy('ODKFiles/zeroRecords_bc_export.csv',
                    'ODKFiles/odkBCExportNew.csv')
        if os.path.isfile('OpenVAFiles/openVA_input.csv'):
            os.remove('OpenVAFiles/openVA_input.csv')
        if not os.path.isfile('Pipeline.db'):
            createTransferDB('Pipeline.db', '.', 'enilepiP')

        # pipelineRunDate = datetime.datetime.now()
        pipelineRunDate = datetime.datetime(2018, 9, 1, 9, 0, 0). \
                            strftime('%Y_%m_%d_%H:%M:%S')
        xferDB = TransferDB(dbFileName = 'Pipeline.db',
                            dbDirectory = '.',
                            dbKey = 'enilepiP',
                            plRunDate = pipelineRunDate)
        conn = xferDB.connectDB()
        settingsPipeline = xferDB.configPipeline(conn)
        settingsODK = xferDB.configODK(conn)
        settingsInterVA = xferDB.configOpenVA(conn,
                                              'InterVA',
                                              settingsPipeline.workingDirectory)
        cls.staticRunDate = datetime.datetime(2018, 9, 1, 9, 0, 0). \
                            strftime('%Y_%m_%d_%H:%M:%S')

        shutil.rmtree(
            os.path.join('OpenVAFiles', cls.staticRunDate),
            ignore_errors = True
        )

        rOpenVA = OpenVA(vaArgs = settingsInterVA,
                         pipelineArgs = settingsPipeline,
                         odkID = settingsODK.odkID,
                         runDate = cls.staticRunDate)
        cls.zeroRecords = rOpenVA.copyVA()
Esempio n. 7
0
class Check_Exceptions(unittest.TestCase):


    def setUp(self):

        if os.path.isfile('ODKFiles/odkBCExportNew.csv'):
            os.remove('ODKFiles/odkBCExportNew.csv')
        if os.path.isfile('ODKFiles/odkBCExportPrev.csv'):
            os.remove('ODKFiles/odkBCExportPrev.csv')
        shutil.copy('ODKFiles/odkExport_phmrc-1.csv',
                    'ODKFiles/odkBCExportPrev.csv')
        shutil.copy('ODKFiles/odkExport_phmrc-2.csv',
                    'ODKFiles/odkBCExportNew.csv')
        if not os.path.isfile('smartva'):
            downloadSmartVA()

        self.staticRunDate = datetime.datetime(2018, 9, 1, 9, 0, 0). \
                        strftime('%Y_%m_%d_%H:%M:%S')
        xferDB = TransferDB(dbFileName = 'copy_Pipeline.db',
                            dbDirectory = '.',
                            dbKey = 'enilepiP',
                            plRunDate = self.staticRunDate)
        conn = xferDB.connectDB()
        c = conn.cursor()
        if self.id() == 'test_openVA.Check_Exceptions.test_insilico_exception':
            algorithm = 'InSilicoVA'
            sql = 'UPDATE Pipeline_Conf SET algorithm = ?, algorithmMetadataCode = ?'
            par = ('InSilicoVA', 'InSilicoVA|1.1.4|Custom|1|2016 WHO Verbal Autopsy Form|v1_4_1')
            c.execute(sql, par)
            sql = 'UPDATE InSilicoVA_Conf SET data_type = ?'
            par = ('WHO2016',)
            c.execute(sql, par)
        elif self.id() == 'test_openVA.Check_Exceptions.test_interva_exception':
            algorithm = 'InterVA'
            sql = 'UPDATE Pipeline_Conf SET algorithm = ?, algorithmMetadataCode = ?'
            par = ('InterVA', 'InterVA4|4.04|Custom|1|2016 WHO Verbal Autopsy Form|v1_4_1')
            c.execute(sql, par)
            sql = 'UPDATE InterVA_Conf SET version = ?'
            par = ('5',)
            c.execute(sql, par)
        else:
            algorithm = 'SmartVA'
            sql = 'UPDATE Pipeline_Conf SET algorithm = ?, algorithmMetadataCode = ?'
            par = ('SmartVA', 'SmartVA|2.0.0_a8|PHMRCShort|1|PHMRCShort|1')
            c.execute(sql, par)
        settingsPipeline = xferDB.configPipeline(conn)
        settingsODK = xferDB.configODK(conn)
        settingsAlgorithm = xferDB.configOpenVA(conn,
                                                algorithm,
                                                settingsPipeline.workingDirectory)
        if self.id() == 'test_openVA.Check_Exceptions.test_smartva_exception':
            ntSmartVA = collections.namedtuple("ntSmartVA",
                                               ["SmartVA_country",
                                                "SmartVA_hiv",
                                                "SmartVA_malaria",
                                                "SmartVA_hce",
                                                "SmartVA_freetext",
                                                "SmartVA_figures",
                                                "SmartVA_language"]
            )
            settingsAlgorithm = ntSmartVA("Unknown",
                                          "Wrong",
                                          "Wrong",
                                          "Wrong",
                                          "Wrong",
                                          "Wrong",
                                          "Wrong")

        conn.rollback()
        conn.close()
        self.rOpenVA = OpenVA(vaArgs = settingsAlgorithm,
                              pipelineArgs = settingsPipeline,
                              odkID = '',
                              runDate = self.staticRunDate)
        zeroRecords = self.rOpenVA.copyVA()
        self.rOpenVA.rScript()

    def test_insilico_exception(self):
        """getCOD() raises exception with faulty R script for InSilicoVA."""

        self.assertRaises(OpenVAError, self.rOpenVA.getCOD)

    def test_interva_exception(self):
        """getCOD() should raise an exception with problematic interva R script."""

        self.assertRaises(OpenVAError, self.rOpenVA.getCOD)

    def test_smartva_exception(self):
        """getCOD() should raise an exception with faulty args for smartva cli"""

        self.assertRaises(SmartVAError, self.rOpenVA.getCOD)

    def tearDown(self):
        shutil.rmtree(
            os.path.join('OpenVAFiles', self.staticRunDate),
            ignore_errors = True
        )
        if os.path.isfile('ODKFiles/odkBCExportNew.csv'):
            os.remove('ODKFiles/odkBCExportNew.csv')
        if os.path.isfile('ODKFiles/odkBCExportPrev.csv'):
            os.remove('ODKFiles/odkBCExportPrev.csv')
        if os.path.isfile('OpenVAFiles/openVA_input.csv'):
            os.remove('OpenVAFiles/openVA_input.csv')
        if os.path.isfile("OpenVAFiles/recordStorage.csv"):
            os.remove("OpenVAFiles/recordStorage.csv")
        if os.path.isfile("OpenVAFiles/entityAttributeValue.csv"):
            os.remove("OpenVAFiles/entityAttributeValue.csv")
Esempio n. 8
0
class Check_Exceptions_SmartVA(unittest.TestCase):


    @classmethod
    def setUpClass(cls):

        if os.path.isfile('ODKFiles/odkBCExportNew.csv'):
            os.remove('ODKFiles/odkBCExportNew.csv')
        if os.path.isfile('ODKFiles/odkBCExportPrev.csv'):
            os.remove('ODKFiles/odkBCExportPrev.csv')
        shutil.copy('ODKFiles/odkExport_phmrc-1.csv',
                    'ODKFiles/odkBCExportPrev.csv')
        shutil.copy('ODKFiles/odkExport_phmrc-2.csv',
                    'ODKFiles/odkBCExportNew.csv')
        if not os.path.isfile('smartva'):
            downloadSmartVA()
       
    def setUp(self):
        
        staticRunDate = datetime.datetime(
            2018, 9, 1, 9, 0, 0).strftime('%Y_%m_%d_%H:%M:%S')
        xferDB = TransferDB(dbFileName='copy_Pipeline.db',
                                dbDirectory='.',
                                dbKey='enilepiP',
                                plRunDate=staticRunDate)
        conn = xferDB.connectDB()
        c = conn.cursor()
        algorithm = 'SmartVA'
        sql = 'UPDATE Pipeline_Conf SET algorithm = ?, algorithmMetadataCode = ?'
        par = ('SmartVA', 'SmartVA|2.0.0_a8|PHMRCShort|1|PHMRCShort|1')
        c.execute(sql, par)
        ntSmartVA = collections.namedtuple("ntSmartVA",
                                           ["SmartVA_country",
                                            "SmartVA_hiv",
                                            "SmartVA_malaria",
                                            "SmartVA_hce",
                                            "SmartVA_freetext",
                                            "SmartVA_figures",
                                            "SmartVA_language"])
        settingsAlgorithm = ntSmartVA("Unknown",
                                      "Wrong",
                                      "Wrong",
                                      "Wrong",
                                      "Wrong",
                                      "Wrong",
                                      "Wrong")
        settingsPipeline = xferDB.configPipeline(conn)

        self.rOpenVA = OpenVA(vaArgs=settingsAlgorithm,
                              pipelineArgs=settingsPipeline,
                              odkID=None,
                              runDate=staticRunDate)
        zeroRecords = self.rOpenVA.copyVA()
        conn.rollback()
        conn.close()

    def test_smartva_exception(self):
        """getCOD() should raise an exception with faulty args for smartva cli"""

        self.assertRaises(SmartVAError, self.rOpenVA.getCOD)

    def tearDown(self):
        staticRunDate = datetime.datetime(
            2018, 9, 1, 9, 0, 0).strftime('%Y_%m_%d_%H:%M:%S')
        shutil.rmtree(
            os.path.join('OpenVAFiles', staticRunDate),
            ignore_errors=True
        )

    @classmethod
    def tearDownClass(cls):
    
        if os.path.isfile('ODKFiles/odkBCExportNew.csv'):
            os.remove('ODKFiles/odkBCExportNew.csv')
        if os.path.isfile('ODKFiles/odkBCExportPrev.csv'):
            os.remove('ODKFiles/odkBCExportPrev.csv')
        if os.path.isfile('OpenVAFiles/openVA_input.csv'):
            os.remove('OpenVAFiles/openVA_input.csv')
        if os.path.isfile("OpenVAFiles/recordStorage.csv"):
            os.remove("OpenVAFiles/recordStorage.csv")
        if os.path.isfile("OpenVAFiles/entityAttributeValue.csv"):
            os.remove("OpenVAFiles/entityAttributeValue.csv")
Esempio n. 9
0
class Check_Exceptions_InterVA(unittest.TestCase):


    @classmethod
    def setUpClass(cls):

        if os.path.isfile('ODKFiles/odkBCExportNew.csv'):
            os.remove('ODKFiles/odkBCExportNew.csv')
        if os.path.isfile('ODKFiles/odkBCExportPrev.csv'):
            os.remove('ODKFiles/odkBCExportPrev.csv')
        shutil.copy('ODKFiles/odkExport_phmrc-1.csv',
                    'ODKFiles/odkBCExportPrev.csv')
        shutil.copy('ODKFiles/odkExport_phmrc-2.csv',
                    'ODKFiles/odkBCExportNew.csv')

       
    def setUp(self):
        
        staticRunDate = datetime.datetime(
            2018, 9, 1, 9, 0, 0).strftime('%Y_%m_%d_%H:%M:%S')
        xferDB = TransferDB(dbFileName='copy_Pipeline.db',
                                dbDirectory='.',
                                dbKey='enilepiP',
                                plRunDate=staticRunDate)
        conn = xferDB.connectDB()
        c = conn.cursor()
        algorithm = 'InterVA'
        sql = 'UPDATE Pipeline_Conf SET algorithm = ?, algorithmMetadataCode = ?'
        par = ('InterVA', 'InterVA4|4.04|Custom|1|2016 WHO Verbal Autopsy Form|v1_4_1')
        c.execute(sql, par)
        sql = 'UPDATE InterVA_Conf SET version = ?'
        par = ('4',)
        c.execute(sql, par)
        settingsPipeline = xferDB.configPipeline(conn)
        settingsAlgorithm = xferDB.configOpenVA(conn,
                                                algorithm,
                                                settingsPipeline.workingDirectory)

        self.rOpenVA = OpenVA(vaArgs=settingsAlgorithm,
                              pipelineArgs=settingsPipeline,
                              odkID=None,
                              runDate=staticRunDate)
        zeroRecords = self.rOpenVA.copyVA()
        self.rOpenVA.rScript()
        conn.rollback()
        conn.close()

    def test_interva_exception(self):
        """getCOD() should raise an exception with problematic Interva R script."""

        self.assertRaises(OpenVAError, self.rOpenVA.getCOD)

    def tearDown(self):
        staticRunDate = datetime.datetime(
            2018, 9, 1, 9, 0, 0).strftime('%Y_%m_%d_%H:%M:%S')
        shutil.rmtree(
            os.path.join('OpenVAFiles', staticRunDate),
            ignore_errors=True
        )

    @classmethod
    def tearDownClass(cls):
    
        if os.path.isfile('ODKFiles/odkBCExportNew.csv'):
            os.remove('ODKFiles/odkBCExportNew.csv')
        if os.path.isfile('ODKFiles/odkBCExportPrev.csv'):
            os.remove('ODKFiles/odkBCExportPrev.csv')
        if os.path.isfile('OpenVAFiles/openVA_input.csv'):
            os.remove('OpenVAFiles/openVA_input.csv')
        if os.path.isfile("OpenVAFiles/recordStorage.csv"):
            os.remove("OpenVAFiles/recordStorage.csv")
        if os.path.isfile("OpenVAFiles/entityAttributeValue.csv"):
            os.remove("OpenVAFiles/entityAttributeValue.csv")