You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by bo...@apache.org on 2017/01/31 18:56:29 UTC

incubator-airflow git commit: [AIRFLOW-821] Fix py3 compatibility

Repository: incubator-airflow
Updated Branches:
  refs/heads/master 2b13109ff -> fbb59b944


[AIRFLOW-821] Fix py3 compatibility

iteritems() does not exist in py3.

Closes #2039 from bolkedebruin/AIRFLOW-821


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

Branch: refs/heads/master
Commit: fbb59b94467d7e684620570407698f509b073e47
Parents: 2b13109
Author: Bolke de Bruin <bo...@xs4all.nl>
Authored: Tue Jan 31 18:56:18 2017 +0000
Committer: Bolke de Bruin <bo...@xs4all.nl>
Committed: Tue Jan 31 18:56:18 2017 +0000

----------------------------------------------------------------------
 airflow/jobs.py | 3 ++-
 tests/jobs.py   | 8 --------
 2 files changed, 2 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/fbb59b94/airflow/jobs.py
----------------------------------------------------------------------
diff --git a/airflow/jobs.py b/airflow/jobs.py
index 1a581e9..1362814 100644
--- a/airflow/jobs.py
+++ b/airflow/jobs.py
@@ -28,6 +28,7 @@ import socket
 import multiprocessing
 import os
 import signal
+import six
 import sys
 import threading
 import time
@@ -691,7 +692,7 @@ class SchedulerJob(BaseJob):
             ).delete()
 
         # Add the errors of the processed files
-        for filename, stacktrace in dagbag.import_errors.iteritems():
+        for filename, stacktrace in six.iteritems(dagbag.import_errors):
             session.add(models.ImportError(
                 filename=filename,
                 stacktrace=stacktrace))

http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/fbb59b94/tests/jobs.py
----------------------------------------------------------------------
diff --git a/tests/jobs.py b/tests/jobs.py
index b674bcd..ee4c8a7 100644
--- a/tests/jobs.py
+++ b/tests/jobs.py
@@ -51,8 +51,6 @@ except ImportError:
     except ImportError:
         mock = None
 
-IS_PYTHON_3_TRAVIS = sys.version_info >= (3, 0) and "TRAVIS" in os.environ
-
 DEV_NULL = '/dev/null'
 DEFAULT_DATE = datetime.datetime(2016, 1, 1)
 
@@ -1244,8 +1242,6 @@ class SchedulerJobTest(unittest.TestCase):
         # The DR should be scheduled BEFORE now
         self.assertLess(dr.execution_date, datetime.datetime.now())
 
-    @unittest.skipIf(IS_PYTHON_3_TRAVIS,
-                     "Fails in Python 3 on Travis but not reproducible locally")
     def test_add_unparseable_file_before_sched_start_creates_import_error(self):
         try:
             dags_folder = mkdtemp()
@@ -1266,8 +1262,6 @@ class SchedulerJobTest(unittest.TestCase):
         self.assertEqual(import_error.stacktrace,
                          "invalid syntax ({}, line 1)".format(TEMP_DAG_FILENAME))
 
-    @unittest.skipIf(IS_PYTHON_3_TRAVIS,
-                     "Fails in Python 3 on Travis but not reproducible locally")
     def test_add_unparseable_file_after_sched_start_creates_import_error(self):
         try:
             dags_folder = mkdtemp()
@@ -1306,8 +1300,6 @@ class SchedulerJobTest(unittest.TestCase):
 
         self.assertEqual(len(import_errors), 0)
 
-    @unittest.skipIf(IS_PYTHON_3_TRAVIS,
-                     "Fails in Python 3 on Travis but not reproducible locally")
     def test_new_import_error_replaces_old(self):
         try:
             dags_folder = mkdtemp()