Commit 71ff6708 authored by Oliver Smart's avatar Oliver Smart
Browse files

Test process_components_cif with a filename that cannot exist.

For issue #17 process_components_cif script to read complete components.cif and produce PDBeChem ftp area

Currently fails test - because specifying output directory as None - currently not allowed:

        (new-rdkit-env3) [osmart@swannandrh6d pdbeccdutils]$ nosetests /ebi/msd/work2/osmart/ccd_utils/pdbeccdutils/tests/test_process_components_cif_cli.py
        usage: nosetests [-h] [--debug] COMPONENTS_CIF OUTPUT_DIR
        nosetests: error: the following arguments are required: COMPONENTS_CIF, OUTPUT_DIR
        .E...................................................................................................................
        ======================================================================
        ERROR: tests.test_process_components_cif_cli.test_input_file_that_cannot_exist_raises_system_exit
        ----------------------------------------------------------------------
        Traceback (most recent call last):
          File "/ebi/msd/work2/osmart/conda/envs/new-rdkit-env3/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
            self.test(*self.arg)
          File "/ebi/msd/work2/osmart/ccd_utils/pdbeccdutils/tests/test_process_components_cif_cli.py", line 24, in test_input_file_that_cannot_exist_raises_system_exit
            output_dir=None, debug=False))
          File "/nfs/msd/work2/osmart/ccd_utils/pdbeccdutils/process_components_cif_cli.py", line 81, in process_components_cif
            create_directory_using_mkdir_unless_it_exists(output_dir)
          File "/nfs/msd/work2/osmart/ccd_utils/pdbeccdutils/utilities.py", line 27, in create_directory_using_mkdir_unless_it_exists
            os.mkdir(path)
        TypeError: mkdir: can't specify None for path argument
        -------------------- >> begin captured logging << --------------------
         : DEBUG: components_cif=/////impossible_to_open_file output_dir=None
        --------------------- >> end captured logging << ---------------------

        ----------------------------------------------------------------------
        Ran 117 tests in 2.090s

        FAILED (errors=1)
parent 02964172
......@@ -5,20 +5,25 @@ import glob
import os
import shutil
from nose.tools import assert_raises, assert_true, assert_equal, assert_in
from nose.tools import assert_raises, assert_true, assert_equal
from process_components_cif_cli import create_parser, process_components_cif, file_subdirs, images_subdirs
from utilities import test_components_cif_first_file_comps, file_name_in_tsts_out
from pdbeccdutils.process_components_cif_cli import create_parser, process_components_cif, file_subdirs, images_subdirs
from pdbeccdutils.utilities import test_components_cif_first_file_comps, file_name_in_tsts_out
def test_with_empty_args():
"""
User passes no args, should produce a usage statement and then raise SystemExit. Usage statement will start
User passes no args, should produce a usage statement and then raise SystemExit. Usage statement will appear
"""
parser = create_parser()
assert_raises(SystemExit, parser.parse_args, [])
def test_input_file_that_cannot_exist_raises_system_exit():
assert_raises(SystemExit, process_components_cif(components_cif='/////impossible_to_open_file',
output_dir=None, debug=False))
def test_with_components_cif_first_file_comps():
parser = create_parser()
test_components_cif = test_components_cif_first_file_comps
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment