Skip to content

Commit

Permalink
some test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
scopatz committed Jan 25, 2017
1 parent 85416b4 commit 387e070
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
7 changes: 4 additions & 3 deletions release/smbchk.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
$ ./smbchk.py --update -t HEAD --no-save --check
"""
from __future__ import print_function
from __future__ import print_function, unicode_literals
import os
import io
import re
Expand Down Expand Up @@ -84,7 +84,8 @@ def nm(ns):
# because everything else should be external to the cares of cyclus
# stability
lib = os.path.abspath(os.path.join(ns.prefix, 'lib', 'libcyclus.so'))
stdout = subprocess.check_output(['nm', '-g', '-p', '-C', '-fbsd', lib])
stdout = subprocess.check_output(['nm', '-g', '-p', '-C', '-fbsd', lib],
universal_newlines=True)
names = set()
ok_types = {'B', 'b', 'D', 'd', 'R', 'r',
'S', 's', 'T', 't', 'W', 'w', 'u'}
Expand All @@ -93,7 +94,7 @@ def nm(ns):
for symbol in SYMBOLS_REPLACEMENTS:
line = line.replace(symbol[0], symbol[1])

line = line.strip().decode()
line = line.strip()
if len(line) == 0 or not line[0].isdigit():
continue
val, typ, name = line.split(None, 2)
Expand Down
5 changes: 3 additions & 2 deletions tests/test_include_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
h5out, sqliteout, clean_outs, which_outfile


INPUT = os.path.join(os.path.dirname(__file__), "input")
CWD = os.path.dirname(__file__)
INPUT = os.path.join(CWD, "input")

def test_include_recipe():
"""Testing for including of other XML files.
Expand All @@ -20,7 +21,7 @@ def test_include_recipe():
holdsrtn = [1] # needed because nose does not send() to test generator
outfile = which_outfile()
cmd = ["cyclus", "-o", outfile, "--input-file", sim_input]
yield check_cmd, cmd, '.', holdsrtn
yield check_cmd, cmd, CWD, holdsrtn
rtn = holdsrtn[0]
if rtn != 0:
return # don't execute further commands
Expand Down
24 changes: 12 additions & 12 deletions tests/test_smbchk.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import print_function
from __future__ import print_function, unicode_literals
import os
import platform
import sys
Expand All @@ -15,10 +15,10 @@
blddir = os.path.join(cycdir, 'build')
sys.path.insert(0, reldir)

try:
try:
import smbchk
except ImportError:
smbchk = False
smbchk = False

def test_load():
if not smbchk:
Expand All @@ -41,10 +41,10 @@ def test_nm():
def test_diff():
if not smbchk:
return
db = [{'symbols': ["cyclus::Agent::Agent(cyclus::Context*)"],
'version': 'X', 'date': 'x.x.x'},
{'symbols': ["cyclus::Agent::Agent(cyclus::Context*)",
"cyclus::Agent::~Agent()"],
db = [{'symbols': ["cyclus::Agent::Agent(cyclus::Context*)"],
'version': 'X', 'date': 'x.x.x'},
{'symbols': ["cyclus::Agent::Agent(cyclus::Context*)",
"cyclus::Agent::~Agent()"],
'version': 'Y', 'date': 'y.y.y'},]
obs = smbchk.diff(db, 0, 1)
assert_true(len(obs) > 0)
Expand All @@ -53,16 +53,16 @@ def test_check():
if not smbchk:
return
# adds to API
db = [{'symbols': ["cyclus::Agent::Agent(cyclus::Context*)"],
'version': 'X', 'date': 'x.x.x'},
{'symbols': ["cyclus::Agent::Agent(cyclus::Context*)",
"cyclus::Agent::~Agent()"],
db = [{'symbols': ["cyclus::Agent::Agent(cyclus::Context*)"],
'version': 'X', 'date': 'x.x.x'},
{'symbols': ["cyclus::Agent::Agent(cyclus::Context*)",
"cyclus::Agent::~Agent()"],
'version': 'Y', 'date': 'y.y.y'},]
obs = smbchk.check(db)
assert_true(obs)

# removes from API
db.append({'symbols': ["cyclus::Agent::~Agent()"],
db.append({'symbols': ["cyclus::Agent::~Agent()"],
'version': 'Z', 'date': 'z.z.z'})
obs = smbchk.check(db)
assert_false(obs)
Expand Down

0 comments on commit 387e070

Please sign in to comment.