Skip to content

Commit 534d1f4

Browse files
committed
Merge pull request #199 from rwest/fixtests
Progress towards fixing unit tests. There are some fixes to the makefile, instructions, and default database location. Also, a work_in_progress decorator, that we should use to annotate any Unit Tests that we currently expect to fail. You just add @work_in_progress to the line before the unit test definition. If someone could do that for all the currently failing tests, as a half-way house to actually making them work, we will at least be able to detect changes and extra errors.
2 parents 6dbb675 + 3103536 commit 534d1f4

File tree

6 files changed

+45
-14
lines changed

6 files changed

+45
-14
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@ minimal:
1414
python setup.py build_ext minimal --build-lib . --build-temp build --pyrex-c-in-temp
1515

1616
main:
17+
echo "Checking you have PyDQED..."
18+
@ python -c 'import pydqed; print pydqed.__file__'
1719
python setup.py build_ext main --build-lib . --build-temp build --pyrex-c-in-temp
1820

1921
measure:
2022
python setup.py build_ext measure --build-lib . --build-temp build --pyrex-c-in-temp
2123

2224
solver:
25+
echo "Checking you have PyDAS..."
26+
@ python -c 'import pydas; print pydas.__file__'
2327
python setup.py build_ext solver --build-lib . --build-temp build --pyrex-c-in-temp
2428

2529
cantherm:

documentation/source/users/rmg/installation/linux.rst

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ The instructions listed below have been confirmed on a fresh Ubuntu 12.04 instal
2626
sudo pip install scipy cython nose matplotlib quantities guppy sphinx psutil xlwt freetype2 libpng-dev
2727
2828
cd ~
29-
git clone git@github.com:jwallen/PyDAS.git
30-
git clone git@github.com:jwallen/PyDQED.git
31-
cd PyDAS; make F77=gfortran; sudo make install
32-
cd ../PyDQED; make F77=gfortran; sudo make install
29+
git clone https://github.com/GreenGroup/PyDAS.git
30+
git clone https://github.com/GreenGroup/PyDQED.git
31+
cd PyDAS; make F77=gfortran; sudo make install; cd ..
32+
cd PyDQED; make F77=gfortran; sudo make install; cd ..
3333

3434
* Install RDKit
3535

@@ -61,10 +61,11 @@ The instructions listed below have been confirmed on a fresh Ubuntu 12.04 instal
6161
* Install RMG-Py: ::
6262

6363
cd ~
64-
git clone git@github.com:GreenGroup/RMG-database.git
65-
git clone git@github.com:GreenGroup/RMG-Py.git
64+
git clone https://github.com/GreenGroup/RMG-database.git
65+
git clone https://github.com/GreenGroup/RMG-Py.git
6666
sudo pip install -r RMG-Py/requirements.txt
67-
cd RMG-Py; make
67+
cd RMG-Py
68+
make
6869

6970
* Run an example: ::
7071

@@ -74,6 +75,6 @@ The instructions listed below have been confirmed on a fresh Ubuntu 12.04 instal
7475

7576
You can also use the Makefile targets to test and run examples: ::
7677
77-
make test
78-
make eg1
79-
make eg2
78+
make test
79+
make eg1
80+
make eg2

external/wip.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env python
2+
# encoding: utf-8
3+
#
4+
# Decorator to mark a unit test as a "work_in_progress"
5+
# From http://www.natpryce.com/articles/000788.html
6+
# Copyright 2011 Nat Pryce. Posted 2011-05-30
7+
from functools import wraps
8+
from nose.plugins.attrib import attr
9+
from nose.plugins.skip import SkipTest
10+
11+
def fail(message):
12+
raise AssertionError(message)
13+
14+
def work_in_progress(f):
15+
@wraps(f)
16+
def run_test(*args, **kwargs):
17+
try:
18+
f(*args, **kwargs)
19+
except Exception as e:
20+
raise SkipTest("WIP test failed: " + str(e))
21+
fail("test passed but marked as work in progress")
22+
23+
return attr('work_in_progress')(run_test)

rmgpy/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ def reset(self):
139139
Reset all settings to their default values.
140140
"""
141141
self.filename = None
142-
working_dir = os.path.abspath(os.path.dirname(__file__))
143-
self['database.directory'] = os.path.realpath(os.path.join(working_dir, '..', '..', 'RMG-database', 'input'))
142+
rmgpy_module_dir = os.path.abspath(os.path.dirname(__file__))
143+
self['database.directory'] = os.path.realpath(os.path.join(rmgpy_module_dir, '..', '..', 'RMG-database', 'input'))
144144
self.sources['database.directory'] = 'Default, relative to RMG-Py source code'
145145

146146
# The global settings object

rmgpy/cantherm/gaussianTest.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
from rmgpy.cantherm.gaussian import GaussianLog
99
from rmgpy.statmech import Conformer, IdealGasTranslation, LinearRotor, NonlinearRotor, HarmonicOscillator, HinderedRotor
1010
import rmgpy.constants as constants
11-
11+
from external.wip import work_in_progress
1212
################################################################################
1313

1414
class GaussianTest(unittest.TestCase):
1515
"""
1616
Contains unit tests for the chempy.io.gaussian module, used for reading
1717
and writing Gaussian files.
1818
"""
19-
19+
@work_in_progress
2020
def testLoadEthyleneFromGaussianLog_CBSQB3(self):
2121
"""
2222
Uses a Gaussian03 log file for ethylene (C2H4) to test that its
@@ -71,6 +71,7 @@ def testLoadOxygenFromGaussianLog(self):
7171
self.assertEqual(conformer.spinMultiplicity, 3)
7272
self.assertEqual(conformer.opticalIsomers, 1)
7373

74+
@work_in_progress
7475
def testLoadEthyleneFromGaussianLog_G3(self):
7576
"""
7677
Uses a Gaussian03 log file for ethylene (C2H4) to test that its

rmgpy/data/solvationTest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import os
55
from unittest import TestCase
6+
from external.wip import work_in_progress
67

78
from rmgpy import settings
89
from rmgpy.species import Species
@@ -55,6 +56,7 @@ def testSoluteGeneration(self):
5556
print self.assertAlmostEqual(soluteData.L, L)
5657
print self.assertAlmostEqual(soluteData.A, A)
5758

59+
@work_in_progress
5860
def testCorrectionGeneration(self):
5961
"Test we can estimate solvation thermochemistry."
6062
self.database = SolvationDatabase()

0 commit comments

Comments
 (0)