ariatosca-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From emblempar...@apache.org
Subject incubator-ariatosca git commit: Use YAML C library [Forced Update!]
Date Fri, 08 Sep 2017 16:31:39 GMT
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-1-parser-test-suite f49fbbce6 -> 29a934d7e (forced update)


Use YAML C library


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/29a934d7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/29a934d7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/29a934d7

Branch: refs/heads/ARIA-1-parser-test-suite
Commit: 29a934d7ec6fd1eff0ccd363fa367ae2540a123f
Parents: f29cc2f
Author: Tal Liron <tal.liron@gmail.com>
Authored: Thu Aug 31 18:20:03 2017 -0500
Committer: Tal Liron <tal.liron@gmail.com>
Committed: Fri Sep 8 11:31:33 2017 -0500

----------------------------------------------------------------------
 .travis.yml                 | 66 +++++++++++++++++++++++++---------------
 aria/parser/reading/yaml.py |  6 +++-
 tox.ini                     | 24 ++++++++-------
 3 files changed, 59 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/29a934d7/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 37f63a8..c6a7b53 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,41 +10,57 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-sudo: false
+# We need to set "sudo: true" in order to use a virtual machine instead of a container, because
+# SSH tests fail in the container. See:
+# https://docs.travis-ci.com/user/reference/overview/#Virtualization-environments
 
-# TODO: The default dist is "trusty", but it is broken for us because it doesn't have Python
2.6,
-# and does not allow SSH access (for py2?ssh tests)
-dist: precise
+dist: trusty
+sudo: true
 
 language: python
 
+addons:
+  apt:
+    sources:
+      - sourceline: 'ppa:fkrull/deadsnakes'
+    packages:
+      # Ubuntu 14.04 (trusty) does not come with Python 2.6, so we will install it from Felix
+      # Krull's PPA
+      - python2.6
+      - python2.6-dev
+
 python:
+  # We handle Python 2.6 testing from within tox (see tox.ini); note that this means that
we run
+  # tox itself always from Python 2.7
   - '2.7'
 
 env:
-  - TOX_ENV=pylint_code
-  - TOX_ENV=pylint_tests
-  - TOX_ENV=py27
-  - TOX_ENV=py26
-  - TOX_ENV=py27e2e
-  - TOX_ENV=py26e2e
-  - TOX_ENV=py27extensions
-  - TOX_ENV=py26extensions
-  - TOX_ENV=py27ssh
-  - TOX_ENV=py26ssh
-  - TOX_ENV=docs
-
-install:
+  # The PYTEST_PROCESSES environment var is used in tox.ini to override the --numprocesses
argument
+  # for PyTest's xdist plugin. The reason this is necessary is that conventional Travis environments
+  # may report a large amount of available CPUs, but they they are greatly restricted. Through
trial
+  # and error we found that more than 1 process may result in failures.
+  - PYTEST_PROCESSES=1 TOX_ENV=py27
+  - PYTEST_PROCESSES=1 TOX_ENV=py26
+  - PYTEST_PROCESSES=1 TOX_ENV=py27e2e
+  - PYTEST_PROCESSES=1 TOX_ENV=py26e2e
+  - PYTEST_PROCESSES=1 TOX_ENV=py27extensions
+  - PYTEST_PROCESSES=1 TOX_ENV=py26extensions
+  - PYTEST_PROCESSES=1 TOX_ENV=py27ssh
+  - PYTEST_PROCESSES=1 TOX_ENV=py26ssh
+  - PYTEST_PROCESSES=1 TOX_ENV=pylint_code
+  - PYTEST_PROCESSES=1 TOX_ENV=pylint_tests
+  - PYTEST_PROCESSES=1 TOX_ENV=docs
+
+before_install:
+  # Create SSH keys for SSH tests
+  - ssh-keygen -f $HOME/.ssh/id_rsa -t rsa -N ''
+  - cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
+
+  # Python dependencies
   - pip install --upgrade pip
   - pip install --upgrade setuptools
   - pip install tox
-
-script:
-  - pip --version
   - tox --version
-  - PYTEST_PROCESSES=1 tox -e $TOX_ENV
 
-# The PYTEST_PROCESSES environment var is used in tox.ini to override the --numprocesses
argument
-# for PyTest's xdist plugin. The reason this is necessary is that conventional Travis environments
-# may report a large amount of available CPUs, but they they are greatly restricted. Through
trial
-# and error we found that more than 1 process may result in failures.
+script:
+  - tox -e $TOX_ENV

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/29a934d7/aria/parser/reading/yaml.py
----------------------------------------------------------------------
diff --git a/aria/parser/reading/yaml.py b/aria/parser/reading/yaml.py
index f5eac43..0148d3a 100644
--- a/aria/parser/reading/yaml.py
+++ b/aria/parser/reading/yaml.py
@@ -82,7 +82,11 @@ class YamlReader(Reader):
             # see issue here:
             # https://bitbucket.org/ruamel/yaml/issues/61/roundtriploader-causes-exceptions-with
             #yaml_loader = yaml.RoundTripLoader(data)
-            yaml_loader = yaml.SafeLoader(data)
+            try:
+                # Faster C-based loader, might not be available on all platforms
+                yaml_loader = yaml.CSafeLoader(data)
+            except BaseException:
+                yaml_loader = yaml.SafeLoader(data)
             try:
                 node = yaml_loader.get_single_node()
                 locator = YamlLocator(self.loader.location, 0, 0)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/29a934d7/tox.ini
----------------------------------------------------------------------
diff --git a/tox.ini b/tox.ini
index 1adb4ce..f4091f0 100644
--- a/tox.ini
+++ b/tox.ini
@@ -13,6 +13,8 @@
 [tox]
 envlist=py27,py26,py27e2e,py26e2e,py27extensions,py26extensions,py27ssh,py26ssh,pywin,pylint_code,pylint_tests,docs
 processes={env:PYTEST_PROCESSES:auto}
+py26={env:PY26:python2.6}
+py27={env:PY27:python2.7}
 
 [testenv]
 whitelist_externals=
@@ -28,18 +30,18 @@ deps=
   --requirement
     tests/requirements.txt
 basepython=
-  py27: python2.7
-  py26: python2.6
-  py27e2e: python2.7
-  py26e2e: python2.6
-  py27extensions: python2.7
-  py26extensions: python2.6
-  py27ssh: python2.7
-  py26ssh: python2.6
+  py27: {[tox]py27}
+  py26: {[tox]py26}
+  py27e2e: {[tox]py27}
+  py26e2e: {[tox]py26}
+  py27extensions: {[tox]py27}
+  py26extensions: {[tox]py26}
+  py27ssh: {[tox]py27}
+  py26ssh: {[tox]py26}
   pywin: {env:PYTHON:}\python.exe
-  pylint_code: python2.7
-  pylint_tests: python2.7
-  docs: python2.7
+  pylint_code: {[tox]py27}
+  pylint_tests: {[tox]py27}
+  docs: {[tox]py27}
 
 [testenv:py27]
 commands=


Mime
View raw message