Skip to content

Commit

Permalink
Merge branch 'master' into get_data
Browse files Browse the repository at this point in the history
  • Loading branch information
apdavison authored Oct 11, 2019
2 parents 07aa7f7 + 7998ccb commit 5928046
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ language: python
sudo: required
python:
- "2.7"
- "3.4"
- "3.5"
- "3.6"
- "3.7"
env:
global:
- PATH=/home/travis/miniconda/bin:$PATH
Expand All @@ -26,7 +26,7 @@ install:
# Useful for debugging any issues with conda
- conda info -a

- conda create -n testenv --yes python=$TRAVIS_PYTHON_VERSION numpy scipy libgfortran matplotlib nose pillow
- conda create -n testenv --yes python=$TRAVIS_PYTHON_VERSION numpy scipy libgfortran-ng matplotlib nose pillow
- source activate testenv
- pip install -r ci/requirements.txt
- pip install -r ci/requirements-test.txt
Expand Down
2 changes: 2 additions & 0 deletions ci/requirements-3.7.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Additional requirements for Python 3.5
pyyaml # this is already in requirements.txt, but pip doesn't allow empty requirements files
5 changes: 3 additions & 2 deletions test/system/test_ircr.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
assert_config, assert_label_equal, assert_records, assert_return_code,
edit_parameters, expected_short_list, substitute_labels)
from functools import partial
import re

repository = "https://bitbucket.org/apdavison/ircr2013"
#repository = "/Volumes/USERS/andrew/dev/ircr2013" # during development
Expand All @@ -48,15 +49,15 @@ def wrapped():
assert_in_output, "updating to branch default"),
("Run the computation without Sumatra",
"python glass_sem_analysis.py default_parameters MV_HFV_012.jpg",
assert_in_output, "2416.86315789 60.0",
assert_in_output, re.compile(r"2416\.863[0-9]* 60\.0"),
assert_file_exists, os.path.join("Data", datetime.now().strftime("%Y%m%d")), # Data subdirectory contains another subdirectory labelled with today's date)
), # assert(subdirectory contains three image files).
("Set up a Sumatra project",
"smt init -d Data -i . ProjectGlass",
assert_in_output, "Sumatra project successfully set up"),
("Run the ``glass_sem_analysis.py`` script with Sumatra",
"smt run -e python -m glass_sem_analysis.py -r 'initial run' default_parameters MV_HFV_012.jpg",
assert_in_output, ("2416.86315789 60.0", "histogram.png")),
assert_in_output, (re.compile(r"2416\.863[0-9]* 60\.0"), "histogram.png")),
("Comment on the outcome",
"smt comment 'works fine'"),
("Set defaults",
Expand Down
9 changes: 6 additions & 3 deletions test/system/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
label_pattern = re.compile("Record label for this run: '(?P<label>[\w\-_]+)'")

info_pattern = r"""Project name : (?P<project_name>\w+)
Default executable : (?P<executable>\w+) \(version: \d+.\d+.\d+\) at /[\w\/_-]+/bin/python
Default executable : (?P<executable>\w+) \(version: \d+.\d+.\d+\) at /[\w\/_.-]+/bin/python
Default repository : MercurialRepository at \S+/sumatra_exercise \(upstream: \S+/ircr2013\)
Default main file : (?P<main>\w+.\w+)
Default launch mode : serial
Expand Down Expand Up @@ -83,10 +83,13 @@ def get_label(p):

def assert_in_output(p, texts):
"""Assert that the stdout from process 'p' contains all of the provided text."""
if isinstance(texts, str):
if isinstance(texts, (str, type(re.compile("")))):
texts = [texts]
for text in texts:
assert text in p.stdout.text, "'{0}' is not in '{1}'".format(text, p.stdout.text)
if isinstance(text, type(re.compile(""))):
assert text.search(p.stdout.text), "regular expression '{0}' has no match in '{1}'".format(text, p.stdout.text)
else:
assert text in p.stdout.text, "'{0}' is not in '{1}'".format(text, p.stdout.text)


def assert_config(p, expected_config):
Expand Down

0 comments on commit 5928046

Please sign in to comment.