From 64f0174cfe7a74f9194a346dd0941073ae7598c8 Mon Sep 17 00:00:00 2001 From: nicobo Date: Mon, 8 Feb 2021 22:29:03 +0100 Subject: [PATCH] ~ using the latest MacOS version to test - not using dirs_exist_ok with copytree to allow Python < 3.8 (not widely supported) --- .travis.yml | 5 +++-- tests/test_options.py | 14 ++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1311758..16b2ee8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,9 +8,9 @@ python: # this works for Linux but is ignored on macOS or Windows # See https://docs.travis-ci.com/user/languages/python/#running-python-tests-on-multiple-operating-systems jobs: include: - - name: "Python 3.7 on macOS" + - name: "Python on macOS" os: osx - osx_image: xcode11.2 # Python 3.7.4 running on macOS 10.14.4 + osx_image: xcode12.2 # Latest version at time of writing : see https://docs.travis-ci.com/user/reference/osx#macos-version language: shell # 'language: python' is an error on Travis CI macOS # Build requisites (only some of them) addons: @@ -27,6 +27,7 @@ addons: - python3-dev - rustc homebrew: + # TODO Check this list to see if something is missing : https://docs.travis-ci.com/user/reference/osx#compilers-and-build-toolchain packages: rust install: - pip3 install -r requirements-build.txt -r requirements-runtime.txt diff --git a/tests/test_options.py b/tests/test_options.py index 90801f3..1487c30 100644 --- a/tests/test_options.py +++ b/tests/test_options.py @@ -58,11 +58,14 @@ class TestOptions(unittest.TestCase): Tests the default configuration tree of the docker image """ - with tempfile.TemporaryDirectory() as tmpdir: + with tempfile.TemporaryDirectory() as tmproot: + # Creates a subdirectory so that we don't need the 'dirs_exist_ok' + # option, which is only available since Python 3.8 + tmpdir = os.path.join(tmproot,"slash") dir_var_nicobot = os.path.join(tmpdir,'var/nicobot') dir_etc_nicobot = os.path.join(tmpdir,'etc/nicobot') # 1. Reproduces the initial Docker environment - shutil.copytree('tests/fixtures/docker_file_tree', tmpdir, dirs_exist_ok=True) + shutil.copytree('tests/fixtures/docker_file_tree', tmpdir) config = TransbotConfig() # Mimics the command line parameters in the docker image args = [ '--config-dirs', dir_var_nicobot, dir_etc_nicobot ] @@ -81,11 +84,14 @@ class TestOptions(unittest.TestCase): Tests a common configuration tree with docker where the user bind-mounts the /var/nicobot directory """ - with tempfile.TemporaryDirectory() as tmpdir: + with tempfile.TemporaryDirectory() as tmproot: + # Creates a subdirectory so that we don't need the 'dirs_exist_ok' + # option, which is only available since Python 3.8 + tmpdir = os.path.join(tmproot,"slash") dir_var_nicobot = os.path.join(tmpdir,'var/nicobot') dir_etc_nicobot = os.path.join(tmpdir,'etc/nicobot') # 1. Reproduces the initial Docker environment - shutil.copytree('tests/fixtures/docker_with_var_mount', tmpdir, dirs_exist_ok=True) + shutil.copytree('tests/fixtures/docker_with_var_mount', tmpdir) config = TransbotConfig() # Mimics the command line parameters in the docker image args = [ '--config-dirs', dir_var_nicobot, dir_etc_nicobot ]