From bdbb502cd94a47673545f3953a0fa2ff1f5194d6 Mon Sep 17 00:00:00 2001
From: Andreas Schenk <andreas_schenk@hms.harvard.edu>
Date: Wed, 29 Aug 2012 10:58:21 -0400
Subject: [PATCH] fixed pdb and mmcif unit tests to correctly handle missing
 OST_ROOT env var

---
 modules/io/tests/test_io_pdb.cc       |  8 +++++++-
 modules/io/tests/test_mmcif_reader.cc | 16 ++++++++++++++--
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/modules/io/tests/test_io_pdb.cc b/modules/io/tests/test_io_pdb.cc
index b0e54cdc3..d1e9526c5 100644
--- a/modules/io/tests/test_io_pdb.cc
+++ b/modules/io/tests/test_io_pdb.cc
@@ -851,7 +851,13 @@ BOOST_AUTO_TEST_CASE(res_name_mismatch_tolerant)
 
 BOOST_AUTO_TEST_CASE(seqres_import)
 {
-  SetPrefixPath(getenv("OST_ROOT"));
+  char * ost_root=getenv("OST_ROOT");
+  if(!ost_root){
+    std::cout << "WARNING: skipping SEQRES import unit test. " 
+              << "Rule-based builder is required" << std::endl;
+    return;
+  }
+  SetPrefixPath(ost_root);
   String lib_path=GetSharedDataPath()+"/compounds.chemlib";
   conop::CompoundLibPtr compound_lib=conop::CompoundLib::Load(lib_path);  
   if (!compound_lib) {
diff --git a/modules/io/tests/test_mmcif_reader.cc b/modules/io/tests/test_mmcif_reader.cc
index eb9c852b5..76125e41d 100644
--- a/modules/io/tests/test_mmcif_reader.cc
+++ b/modules/io/tests/test_mmcif_reader.cc
@@ -139,7 +139,13 @@ BOOST_AUTO_TEST_CASE(mmcif_trystoreidx)
 
 BOOST_AUTO_TEST_CASE(mmcif_convert_seqres)
 {
-  SetPrefixPath(getenv("OST_ROOT"));
+  char * ost_root=getenv("OST_ROOT");
+  if(!ost_root){
+    std::cout << "WARNING: skipping SEQRES import unit test. " 
+              << "Rule-based builder is required" << std::endl;
+    return;
+  }
+  SetPrefixPath(ost_root);
   String lib_path=GetSharedDataPath()+"/compounds.chemlib";
   conop::CompoundLibPtr compound_lib=conop::CompoundLib::Load(lib_path);  
   if (!compound_lib) {
@@ -399,7 +405,13 @@ BOOST_AUTO_TEST_CASE(mmcif_entity_tests)
 
 BOOST_AUTO_TEST_CASE(mmcif_entity_poly_tests)
 {
-  SetPrefixPath(getenv("OST_ROOT"));
+  char * ost_root=getenv("OST_ROOT");
+  if(!ost_root){
+    std::cout << "WARNING: skipping SEQRES import unit test. " 
+              << "Rule-based builder is required" << std::endl;
+    return;
+  }
+  SetPrefixPath(ost_root);
   String lib_path=GetSharedDataPath()+"/compounds.chemlib";
   conop::CompoundLibPtr compound_lib=conop::CompoundLib::Load(lib_path);
   if (!compound_lib) {
-- 
GitLab