Skip to content
Permalink
Browse files

change position of test dir and make test.py more robust

  • Loading branch information...
AlessioMilanese committed Jun 11, 2018
1 parent 8742aa4 commit d6ef475a1e9693ebb325ecd4f0c2408b7468abe2
Showing with 23 additions and 5 deletions.
  1. +1 −0 .gitignore
  2. +9 −0 setup.py
  3. +13 −5 test.py
@@ -1,3 +1,4 @@
*.pyc
*.DS_Store
db_mOTU/
test/
@@ -149,6 +149,15 @@ def main(argv=None):
else:
sys.stderr.write("done\n")

# move the test dir outside db dir -----------------------------------------
sys.stderr.write("Move test directory...")
try:
shutil.move(relative_path+"db_mOTU/test", relative_path)
except shutil.Error as e:
print('test directory not copied. Error: %s' % e)
sys.exit(1)
sys.stderr.write("done\n")

# --- remove db file
sys.stderr.write("Remove zipped file...")
os.remove(db_name)
18 test.py
@@ -50,11 +50,19 @@ def main(argv=None):
if "--skip-setup-check" in sys.argv:
sys.stderr.write("SKIPPED. As requested due to --skip-setup-check\n\n")
else:
if os.path.isdir(relative_path+'db_mOTU'):
sys.stderr.write("done\n\n")
else:
# check that db_mOTU exists
if not(os.path.isdir(relative_path+'db_mOTU')):
sys.stderr.write("ERROR. Run setup.py\n\n")
sys.exit(1)
# check that temp dir exists
if not(os.path.isdir(relative_path+'test')):
sys.stderr.write("ERROR. test directory is missing. Run setup.py\n\n")
sys.exit(1)
# check that files inside temp exists
if not(os.path.isfile(relative_path+'test/test1_single.fastq') and os.path.isfile(relative_path+'test/test1.motus')):
sys.stderr.write("ERROR. test files are missing. Run setup.py\n\n")
sys.exit(1)
sys.stderr.write("done\n\n")


sys.stderr.write("2-- Tools and versions:\n")
@@ -101,8 +109,8 @@ def main(argv=None):
if "--skip-setup-check" in sys.argv:
sys.stderr.write("SKIPPED. Due to --skip-setup-check\n\n")
else:
test_file = relative_path+'db_mOTU/test/test1_single.fastq'
ground_truth_file = relative_path+'db_mOTU/test/test1.motus'
test_file = relative_path+'test/test1_single.fastq'
ground_truth_file = relative_path+'test/test1.motus'
temp_file_profile = tempfile.NamedTemporaryFile(delete=False, mode="w")

sys.stderr.write("\n- Run motus (-v 1, only error messages):\n")

0 comments on commit d6ef475

Please sign in to comment.
You can’t perform that action at this time.