mirror of
https://github.com/certbot/certbot.git
synced 2026-08-02 19:31:51 +02:00
Enable unit tests on OS X (#4697)
* Add OS X test * Fix apache tests * Use absolute path first so that certbot works with non-standard $PATH Some tests use a fake $PATH, which prevents invoking `sw_vers` * Also test Python 3 on Mac * Set ulimit to fix "Too many open files"
This commit is contained in:
committed by
Brad Warren
parent
6f98987c12
commit
c9e9879ad9
+10
-1
@@ -5,7 +5,10 @@ cache:
|
|||||||
- $HOME/.cache/pip
|
- $HOME/.cache/pip
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- 'dpkg -s libaugeas0'
|
- '[ $TRAVIS_OS_NAME == linux ] && dpkg -s libaugeas0 || brew install augeas python3'
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- 'if [ $TRAVIS_OS_NAME = osx ] ; then ulimit -n 1024 ; fi'
|
||||||
|
|
||||||
# using separate envs with different TOXENVs creates 4x1 Travis build
|
# using separate envs with different TOXENVs creates 4x1 Travis build
|
||||||
# matrix, which allows us to clearly distinguish which component under
|
# matrix, which allows us to clearly distinguish which component under
|
||||||
@@ -112,6 +115,12 @@ matrix:
|
|||||||
services: docker
|
services: docker
|
||||||
- python: "2.7"
|
- python: "2.7"
|
||||||
env: TOXENV=nginxroundtrip
|
env: TOXENV=nginxroundtrip
|
||||||
|
- language: generic
|
||||||
|
env: TOXENV=py27
|
||||||
|
os: osx
|
||||||
|
- language: generic
|
||||||
|
env: TOXENV=py36
|
||||||
|
os: osx
|
||||||
|
|
||||||
|
|
||||||
# Only build pushes to the master branch, PRs, and branches beginning with
|
# Only build pushes to the master branch, PRs, and branches beginning with
|
||||||
|
|||||||
@@ -275,9 +275,20 @@ def setup_ssl_options(config_dir, src, dest): # pragma: no cover
|
|||||||
|
|
||||||
def dir_setup(test_dir, pkg): # pragma: no cover
|
def dir_setup(test_dir, pkg): # pragma: no cover
|
||||||
"""Setup the directories necessary for the configurator."""
|
"""Setup the directories necessary for the configurator."""
|
||||||
temp_dir = tempfile.mkdtemp("temp")
|
def expanded_tempdir(prefix):
|
||||||
config_dir = tempfile.mkdtemp("config")
|
"""Return the real path of a temp directory with the specified prefix
|
||||||
work_dir = tempfile.mkdtemp("work")
|
|
||||||
|
Some plugins rely on real paths of symlinks for working correctly. For
|
||||||
|
example, certbot-apache uses real paths of configuration files to tell
|
||||||
|
a virtual host from another. On systems where TMP itself is a symbolic
|
||||||
|
link, (ex: OS X) such plugins will be confused. This function prevents
|
||||||
|
such a case.
|
||||||
|
"""
|
||||||
|
return os.path.realpath(tempfile.mkdtemp(prefix))
|
||||||
|
|
||||||
|
temp_dir = expanded_tempdir("temp")
|
||||||
|
config_dir = expanded_tempdir("config")
|
||||||
|
work_dir = expanded_tempdir("work")
|
||||||
|
|
||||||
os.chmod(temp_dir, constants.CONFIG_DIRS_MODE)
|
os.chmod(temp_dir, constants.CONFIG_DIRS_MODE)
|
||||||
os.chmod(config_dir, constants.CONFIG_DIRS_MODE)
|
os.chmod(config_dir, constants.CONFIG_DIRS_MODE)
|
||||||
|
|||||||
+13
-5
@@ -427,11 +427,19 @@ def get_python_os_info():
|
|||||||
if info[1]:
|
if info[1]:
|
||||||
os_ver = info[1]
|
os_ver = info[1]
|
||||||
elif os_type.startswith('darwin'):
|
elif os_type.startswith('darwin'):
|
||||||
os_ver = subprocess.Popen(
|
try:
|
||||||
["sw_vers", "-productVersion"],
|
proc = subprocess.Popen(
|
||||||
stdout=subprocess.PIPE,
|
["/usr/bin/sw_vers", "-productVersion"],
|
||||||
universal_newlines=True,
|
stdout=subprocess.PIPE,
|
||||||
).communicate()[0].rstrip('\n')
|
universal_newlines=True,
|
||||||
|
)
|
||||||
|
except OSError:
|
||||||
|
proc = subprocess.Popen(
|
||||||
|
["sw_vers", "-productVersion"],
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
universal_newlines=True,
|
||||||
|
)
|
||||||
|
os_ver = proc.communicate()[0].rstrip('\n')
|
||||||
elif os_type.startswith('freebsd'):
|
elif os_type.startswith('freebsd'):
|
||||||
# eg "9.3-RC3-p1"
|
# eg "9.3-RC3-p1"
|
||||||
os_ver = os_ver.partition("-")[0]
|
os_ver = os_ver.partition("-")[0]
|
||||||
|
|||||||
Reference in New Issue
Block a user