def test_getoptions_bad_subcommand_error(self, mock_stderr): # sub-module must be specified with self.assertRaises(SystemExit): qapa.getoptions(['bad']) self.assertIn('argument subcommand: invalid choice:', mock_stderr.getvalue()) self.assertIn("choose from 'build', 'fasta', 'quant'", mock_stderr.getvalue())
def test_quant(self, mock_sys): # should call create_merged_data.R and compute_pau.R db = NamedTemporaryFile() args = qapa.getoptions( ['quant', '--db', db.name, 'test_1.sf', 'test_2.sf']) qapa.quant(args) self.assertRegex(mock_sys.call_args_list[0][0][0], r'create_merged_data.R') self.assertRegex(mock_sys.call_args_list[1][0][0], r'compute_pau.R')
def test_getoptions_no_subcommand_error(self, mock_stderr): with self.assertRaises(SystemExit): qapa.getoptions([]) self.assertIn("Specify sub-command: 'build', 'fasta', 'quant'", mock_stderr.getvalue())