def test_vquest_main_custom_arg(self): """Try an extra argument given as though on the command line.""" with tempfile.TemporaryDirectory() as tempdir: os.chdir(tempdir) main(["--IMGTrefdirSet", "1", str(self.path / "config.yml")]) self.assertTrue(Path("vquest_airr.tsv").exists()) self.assertTrue(Path("Parameters.txt").exists())
def test_vquest_main_no_collapse(self): """Test command-line interface with --no-collapse.""" with tempfile.TemporaryDirectory() as tempdir: os.chdir(tempdir) main(["--no-collapse", str(self.path / "config.yml")]) self.assertTrue(Path("001/vquest_airr.tsv").exists()) self.assertTrue(Path("001/Parameters.txt").exists())
def test_vquest_main(self): """Test that the command-line interface gives the expected response.""" with tempfile.TemporaryDirectory() as tempdir: os.chdir(tempdir) main([str(self.path / "config.yml")]) self.assertTrue(Path("vquest_airr.tsv").exists()) self.assertTrue(Path("Parameters.txt").exists())
def test_vquest_main(self): """Test that an html file with an error message is parsed correctly for cmd-line usage.""" with self.assertRaises(VquestError) as err_cm: with tempfile.TemporaryDirectory() as tempdir: os.chdir(tempdir) main([str(self.path / "config.yml")]) self.assertEqual( err_cm.exception.server_messages, ["The receptor type or locus is not available for this species"])
def test_vquest_main_no_args(self): """Test how the command-line interface handles no arguments. It should exit with a nonzero exit code and write the help text to stdout. """ self.check_missing_defaults_main(lambda: main([]))
def test_vquest_main_alignment(self): """Try using the --align feature. In this case the regular output files should not be created and instead FASTA text should be written to stdout. """ expected = """>IGKV2-ACR*02 gacattgtgatgacccagactccactctccctgcccgtcacccctggagagccagcctccatctcctgcaggtctagtcagagcctcttggatagt...gacgggtacacctgtttggactggtacctgcagaagccaggccagtctccacagctcctgatctatgaggtt.....................tccaaccgggtctctggagtccct...gacaggttcagtggcagtggg......tcagncactgatttcacactgaaaatcagccgggtggaagctgaggatgttggggtgtattactgtatgcaaagtatagagtttcctcc """ out = StringIO() err = StringIO() with redirect_stdout(out), redirect_stderr(err): with tempfile.TemporaryDirectory() as tempdir: os.chdir(tempdir) main([str(self.path / "config.yml"), "--align"]) self.assertFalse(Path("vquest_airr.tsv").exists()) self.assertFalse(Path("Parameters.txt").exists()) self.assertEqual(out.getvalue(), expected) self.assertEqual(err.getvalue(), "")
def test_vquest_main_alignment(self): self.check_missing_defaults_main(lambda: main(["--align"]))
def test_vquest_main_no_collapse(self): self.check_missing_defaults_main(lambda: main(["--no-collapse"]))
def test_vquest_main(self): self.check_missing_defaults( lambda: main([str(self.path / "config.yml")]))