From 930e59fc3c67c3c6c1c84b4ce35aa9a7f1d3b50e Mon Sep 17 00:00:00 2001 From: Samuel Letellier-Duchesne Date: Mon, 2 Dec 2019 15:17:30 -0500 Subject: [PATCH 01/12] Enables CI testing on MacOs platform --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7e0ffcd16..5819b6698 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,8 @@ dist: xenial language: python -os: linux +os: + - linux + - osx env: ARCHETYPAL_INTEGRATION=True ENERGYPLUS_VERSION=8.9.0 ENERGYPLUS_SHA=40101eaafd ENERGYPLUS_INSTALL_VERSION=8-9-0 addons: @@ -55,4 +57,4 @@ script: after_success: - coverage report -m - - coveralls \ No newline at end of file + - coveralls From 0865c9940ae525358671541d651f3863d7d0f9a2 Mon Sep 17 00:00:00 2001 From: Samuel Letellier-Duchesne Date: Mon, 2 Dec 2019 15:40:43 -0500 Subject: [PATCH 02/12] Uses matrix.include to sperate linux and osx behaviors --- .travis.yml | 47 ++++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5819b6698..ed553d87b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,39 @@ -dist: xenial -language: python -os: - - linux - - osx -env: ARCHETYPAL_INTEGRATION=True ENERGYPLUS_VERSION=8.9.0 ENERGYPLUS_SHA=40101eaafd ENERGYPLUS_INSTALL_VERSION=8-9-0 +language: generic +dist: trusty +sudo: required + +env: + global: + - ARCHETYPAL_INTEGRATION=True ENERGYPLUS_VERSION=8.9.0 ENERGYPLUS_SHA=40101eaafd ENERGYPLUS_INSTALL_VERSION=8-9-0 addons: apt: packages: - wine - libgfortran3 + +jobs: + include: + # Linux, on master + - os: linux + dist: xenial + language: python + python: 3.7 + env: TRAVIS_PYTHON_VERSION=3.7 NUMPY=True + install: + - pip install --upgrade setuptools + - pip install --upgrade pip + - python setup.py install + - conda list + script: + - pytest --cov=archetypal --verbose tests/ + + after_success: + - coverage report -m + - coveralls + - os: osx + env: TRAVIS_PYTHON_VERSION=3.7 NUMPY=True + before_install: # install EnergyPlus @@ -47,14 +71,3 @@ before_install: - export PATH="$HOME/miniconda/bin:$PATH" - hash -r - pip install .[dev] - -install: - - python setup.py install - - conda list - -script: - - pytest --cov=archetypal --verbose tests/ - -after_success: - - coverage report -m - - coveralls From f6b697245fd3fdb8fa080636d53ee6e6f13d6025 Mon Sep 17 00:00:00 2001 From: Samuel Letellier-Duchesne Date: Mon, 2 Dec 2019 15:44:58 -0500 Subject: [PATCH 03/12] Should fix OS X build error with file not found "8230" --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ed553d87b..04336bbe5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -63,7 +63,8 @@ before_install: echo "y\r" | sudo ./$ENERGYPLUS_DOWNLOAD_FILENAME.$EXT; fi - sudo rm $ENERGYPLUS_DOWNLOAD_FILENAME.$EXT - - sudo rm 8230 + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then + sudo rm 8230; fi # Install python - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh From 0f67ae4635a05fc976b3e81aaa14137d0eacc9c1 Mon Sep 17 00:00:00 2001 From: Samuel Letellier-Duchesne Date: Mon, 2 Dec 2019 15:52:57 -0500 Subject: [PATCH 04/12] Adds python installation + moves install/script out of matrix --- .travis.yml | 53 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 04336bbe5..11aa24b5a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,17 +20,6 @@ jobs: language: python python: 3.7 env: TRAVIS_PYTHON_VERSION=3.7 NUMPY=True - install: - - pip install --upgrade setuptools - - pip install --upgrade pip - - python setup.py install - - conda list - script: - - pytest --cov=archetypal --verbose tests/ - - after_success: - - coverage report -m - - coveralls - os: osx env: TRAVIS_PYTHON_VERSION=3.7 NUMPY=True @@ -66,9 +55,39 @@ before_install: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo rm 8230; fi - # Install python - - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh - - bash miniconda.sh -b -p $HOME/miniconda - - export PATH="$HOME/miniconda/bin:$PATH" - - hash -r - - pip install .[dev] + # Install python for Linux + - if [ "$TRAVIS_OS_NAME" == "linux" ]; then + wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh + bash miniconda.sh -b -p $HOME/miniconda + export PATH="$HOME/miniconda/bin:$PATH" + hash -r + pip install .[dev] + + # install python for OSX + - if [ "$TRAVIS_OS_NAME" == "osx" ]; then + wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O ~/miniconda.sh; + bash ~/miniconda.sh -b -p $HOME/miniconda; + export PATH="$HOME/miniconda/bin:$PATH"; + conda update --yes conda; + conda create --yes -n venv python=$TRAVIS_PYTHON_VERSION; + fi + + # activate environment + - if [ "$TRAVIS_OS_NAME" == "osx" ]; then source activate venv; fi + - if [ "$TRAVIS_OS_NAME" == "linux" ]; then + virtualenv venv; + source venv/bin/activate; + fi + - python --version; + +install: + - pip install --upgrade setuptools + - pip install --upgrade pip + - python setup.py install + - conda list +script: + - pytest --cov=archetypal --verbose tests/ + +after_success: + - coverage report -m + - coveralls From c3cf1b9d0b92780b108fcdf3e07be944ef8b4bc1 Mon Sep 17 00:00:00 2001 From: Samuel Letellier-Duchesne Date: Mon, 2 Dec 2019 15:59:11 -0500 Subject: [PATCH 05/12] Adds missing "fi" at end of condition block --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 11aa24b5a..b3239c76e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -61,7 +61,8 @@ before_install: bash miniconda.sh -b -p $HOME/miniconda export PATH="$HOME/miniconda/bin:$PATH" hash -r - pip install .[dev] + pip install .[dev]; + fi # install python for OSX - if [ "$TRAVIS_OS_NAME" == "osx" ]; then From fbe4cfd8c7e1ae374ccdec4de281c2d6693aaebb Mon Sep 17 00:00:00 2001 From: Samuel Letellier-Duchesne Date: Mon, 2 Dec 2019 16:17:49 -0500 Subject: [PATCH 06/12] Fixes install of python on linux - adds missing semicolon - changes install from setup.py to pip install .[dev] --- .travis.yml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index b3239c76e..0c669f319 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,9 +19,9 @@ jobs: dist: xenial language: python python: 3.7 - env: TRAVIS_PYTHON_VERSION=3.7 NUMPY=True + env: TRAVIS_PYTHON_VERSION=3.7 - os: osx - env: TRAVIS_PYTHON_VERSION=3.7 NUMPY=True + env: TRAVIS_PYTHON_VERSION=3.7 before_install: @@ -57,11 +57,10 @@ before_install: # Install python for Linux - if [ "$TRAVIS_OS_NAME" == "linux" ]; then - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh - bash miniconda.sh -b -p $HOME/miniconda - export PATH="$HOME/miniconda/bin:$PATH" - hash -r - pip install .[dev]; + wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; + bash miniconda.sh -b -p $HOME/miniconda; + export PATH="$HOME/miniconda/bin:$PATH"; + hash -r; fi # install python for OSX @@ -80,15 +79,14 @@ before_install: source venv/bin/activate; fi - python --version; - + +# Main script install: - pip install --upgrade setuptools - pip install --upgrade pip - - python setup.py install - - conda list + - pip install .[dev] script: - - pytest --cov=archetypal --verbose tests/ - + - py.test --cov=archetypal --verbose tests/ after_success: - coverage report -m - coveralls From 64cdf91aebc67dc498a11229fea6b131d0be7b12 Mon Sep 17 00:00:00 2001 From: Samuel Letellier-Duchesne Date: Mon, 2 Dec 2019 17:15:36 -0500 Subject: [PATCH 07/12] Adds extra conversion files for MacOs build --- .travis.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0c669f319..147d5acfa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,25 +32,33 @@ before_install: - ENERGYPLUS_DOWNLOAD_BASE_URL=https://github.com/NREL/EnergyPlus/releases/download/v$ENERGYPLUS_VERSION - ENERGYPLUS_DOWNLOAD_FILENAME=EnergyPlus-$ENERGYPLUS_VERSION-$ENERGYPLUS_SHA-$PLATFORM-x86_64 - ENERGYPLUS_DOWNLOAD_URL=$ENERGYPLUS_DOWNLOAD_BASE_URL/$ENERGYPLUS_DOWNLOAD_FILENAME.$EXT - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ATTCH=97/8230; fi - - EXTRAS_DOWNLOAD_URL=http://energyplus.helpserve.com/Knowledgebase/Article/GetAttachment/$ATTCH - curl -SLO $ENERGYPLUS_DOWNLOAD_URL + # download extras + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ATTCHBASE=97; ATTCHNUM=8230; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ATTCHBASE=98; ATTCHNUM=8232; fi + - EXTRAS_DOWNLOAD_URL=http://energyplus.helpserve.com/Knowledgebase/Article/GetAttachment/$ATTCHBASE/$ATTCHNUM - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then curl -SLO $EXTRAS_DOWNLOAD_URL; fi - + # install EnergyPlus - if [ "$TRAVIS_OS_NAME" == "osx" ]; then sudo hdiutil attach $ENERGYPLUS_DOWNLOAD_FILENAME.$EXT; sudo installer -pkg /Volumes/$ENERGYPLUS_DOWNLOAD_FILENAME/$ENERGYPLUS_DOWNLOAD_FILENAME.pkg -target /; fi - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo chmod +x $ENERGYPLUS_DOWNLOAD_FILENAME.$EXT; echo "y\r" | sudo ./$ENERGYPLUS_DOWNLOAD_FILENAME.$EXT; - sudo tar zxvf 8230 -C /usr/local/EnergyPlus-$ENERGYPLUS_INSTALL_VERSION/PreProcess/IDFVersionUpdater; + sudo tar zxvf $ATTCHNUM -C /usr/local/EnergyPlus-$ENERGYPLUS_INSTALL_VERSION/PreProcess/IDFVersionUpdater; sudo chmod -R a+rwx /usr/local/EnergyPlus-$ENERGYPLUS_INSTALL_VERSION/PreProcess/IDFVersionUpdater; sudo chmod -R a+rwx /usr/local/EnergyPlus-$ENERGYPLUS_INSTALL_VERSION/ExampleFiles; fi + - if [ "$TRAVIS_OS_NAME" == "osx" ]; then + sudo chmod +x $ENERGYPLUS_DOWNLOAD_FILENAME.$EXT; + echo "y\r" | sudo ./$ENERGYPLUS_DOWNLOAD_FILENAME.$EXT; + sudo tar zxvf $ATTCHNUM -C /Applications/EnergyPlus-$ENERGYPLUS_INSTALL_VERSION/PreProcess/IDFVersionUpdater; + sudo chmod -R a+rwx /Applications/EnergyPlus-$ENERGYPLUS_INSTALL_VERSION/PreProcess/IDFVersionUpdater; + sudo chmod -R a+rwx /Applications/EnergyPlus-$ENERGYPLUS_INSTALL_VERSION/ExampleFiles; fi - if [ "$TRAVIS_OS_NAME" == "windows" ]; then sudo chmod +x $ENERGYPLUS_DOWNLOAD_FILENAME.$EXT; echo "y\r" | sudo ./$ENERGYPLUS_DOWNLOAD_FILENAME.$EXT; fi - + # clean install files - sudo rm $ENERGYPLUS_DOWNLOAD_FILENAME.$EXT - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo rm 8230; fi From 564d3a7732fd834732afb9bbfa298f93275ebba2 Mon Sep 17 00:00:00 2001 From: Samuel Letellier-Duchesne Date: Tue, 3 Dec 2019 11:12:59 -0500 Subject: [PATCH 08/12] Fixes extras download on osx --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 147d5acfa..d78835566 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ jobs: before_install: - # install EnergyPlus + # download EnergyPlus - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then EXT=dmg; PLATFORM=Darwin; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then EXT=sh; PLATFORM=Linux; fi - if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then EXT=exe; PLATFORM=Windows; fi @@ -37,8 +37,7 @@ before_install: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ATTCHBASE=97; ATTCHNUM=8230; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ATTCHBASE=98; ATTCHNUM=8232; fi - EXTRAS_DOWNLOAD_URL=http://energyplus.helpserve.com/Knowledgebase/Article/GetAttachment/$ATTCHBASE/$ATTCHNUM - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - curl -SLO $EXTRAS_DOWNLOAD_URL; fi + - curl -SLO $EXTRAS_DOWNLOAD_URL # install EnergyPlus - if [ "$TRAVIS_OS_NAME" == "osx" ]; then sudo hdiutil attach $ENERGYPLUS_DOWNLOAD_FILENAME.$EXT; From 68afb83d7ded3df030a098cb95a0ca9388cd5a51 Mon Sep 17 00:00:00 2001 From: Samuel Letellier-Duchesne Date: Tue, 3 Dec 2019 11:42:52 -0500 Subject: [PATCH 09/12] Cleans downloaded files + removes problematic command on osx --- .travis.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index d78835566..4972da43a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,8 +49,6 @@ before_install: sudo chmod -R a+rwx /usr/local/EnergyPlus-$ENERGYPLUS_INSTALL_VERSION/PreProcess/IDFVersionUpdater; sudo chmod -R a+rwx /usr/local/EnergyPlus-$ENERGYPLUS_INSTALL_VERSION/ExampleFiles; fi - if [ "$TRAVIS_OS_NAME" == "osx" ]; then - sudo chmod +x $ENERGYPLUS_DOWNLOAD_FILENAME.$EXT; - echo "y\r" | sudo ./$ENERGYPLUS_DOWNLOAD_FILENAME.$EXT; sudo tar zxvf $ATTCHNUM -C /Applications/EnergyPlus-$ENERGYPLUS_INSTALL_VERSION/PreProcess/IDFVersionUpdater; sudo chmod -R a+rwx /Applications/EnergyPlus-$ENERGYPLUS_INSTALL_VERSION/PreProcess/IDFVersionUpdater; sudo chmod -R a+rwx /Applications/EnergyPlus-$ENERGYPLUS_INSTALL_VERSION/ExampleFiles; fi @@ -59,8 +57,7 @@ before_install: echo "y\r" | sudo ./$ENERGYPLUS_DOWNLOAD_FILENAME.$EXT; fi # clean install files - sudo rm $ENERGYPLUS_DOWNLOAD_FILENAME.$EXT - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - sudo rm 8230; fi + - sudo rm $ATTCHNUM # Install python for Linux - if [ "$TRAVIS_OS_NAME" == "linux" ]; then From f885cbb3e59f283fc4eff9d05629b7ad85b7b5fe Mon Sep 17 00:00:00 2001 From: Samuel Letellier-Duchesne Date: Tue, 3 Dec 2019 14:17:39 -0800 Subject: [PATCH 10/12] Adds windows extras info (not used) --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 4972da43a..aab568dd0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,6 +36,7 @@ before_install: # download extras - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ATTCHBASE=97; ATTCHNUM=8230; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ATTCHBASE=98; ATTCHNUM=8232; fi + - if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then ATTCHBASE=86; ATTCHNUM=8231; fi - EXTRAS_DOWNLOAD_URL=http://energyplus.helpserve.com/Knowledgebase/Article/GetAttachment/$ATTCHBASE/$ATTCHNUM - curl -SLO $EXTRAS_DOWNLOAD_URL # install EnergyPlus From 0050141a5508d85c443b1923bb3e700aa710d297 Mon Sep 17 00:00:00 2001 From: Samuel Letellier-Duchesne Date: Tue, 3 Dec 2019 21:43:36 -0500 Subject: [PATCH 11/12] Skips Trnsys test on two different MacOs cases 1-The trnsidf.exe is not specified in docker/trnsidf path 2-The MacOs version is higher than 10.15 Since Catalina, 32 bit apps can't be run, even using wine. --- tests/test_trnsys.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/test_trnsys.py b/tests/test_trnsys.py index 6e38cf065..55e9c198f 100644 --- a/tests/test_trnsys.py +++ b/tests/test_trnsys.py @@ -427,12 +427,30 @@ def test_trnbuild_idf_win32(config): assert res +def get_platform(): + """Returns the MacOs release number as tuple of ints""" + import platform + + release, versioninfo, machine = platform.mac_ver() + release_split = release.split(".") + return tuple(map(int, release_split)) + + @pytest.mark.darwin @pytest.mark.linux -@pytest.mark.xfail( +@pytest.mark.skipif( "TRAVIS" in os.environ and os.environ["TRAVIS"] == "true", reason="Skipping this test on Travis CI.", ) +@pytest.mark.xfail( + not Path("docker/trnsidf/trnsidf.exe").exists(), + reason="xfail since trnsidf.exe is not installed. This test can work if the " + "trnsidf.exe is copied in ./docker/trnsidf", +) +@pytest.mark.skipif( + get_platform() > (10, 15, 0), + reason="Skipping since wine 32bit can't run on MacOs >10.15 (Catalina)", +) def test_trnbuild_idf_darwin_or_linux(config): idf_file = "tests/input_data/trnsys/Building.idf" template = "tests/input_data/trnsys/NewFileTemplate.d18" From 43e657a7365e935d4ec2e62d93c7c6c2de90931a Mon Sep 17 00:00:00 2001 From: Samuel Letellier-Duchesne Date: Mon, 27 Jan 2020 20:51:25 -0500 Subject: [PATCH 12/12] Fixes an issue where the platform number would not cast to an int --- tests/test_trnsys.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/test_trnsys.py b/tests/test_trnsys.py index 55e9c198f..b6a1f825f 100644 --- a/tests/test_trnsys.py +++ b/tests/test_trnsys.py @@ -428,12 +428,20 @@ def test_trnbuild_idf_win32(config): def get_platform(): - """Returns the MacOs release number as tuple of ints""" + """Returns the MacOS release number as tuple of ints""" import platform release, versioninfo, machine = platform.mac_ver() release_split = release.split(".") - return tuple(map(int, release_split)) + return tuple(map(safe_int_cast, release_split)) + + +def safe_int_cast(val, default=0): + """Safely casts a value to an int""" + try: + return int(val) + except (ValueError, TypeError): + return default @pytest.mark.darwin