[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [bridgedb/master] Update Twisted to 19.7.0.



commit 4ee54ce81a5ef7466067f3637258e4aa6de541bc
Author: Philipp Winter <phw@xxxxxxxxx>
Date:   Thu Sep 12 16:27:11 2019 -0700

    Update Twisted to 19.7.0.
    
    In the process, we can also get rid of our build matrix because
    there's no longer a need to test different Twisted (or pyOpenSSL)
    versions.
    
    We had to fix a number of issues to support the latest Twisted version:
    
    * Change Reactor() to createReactor() in a unit test.
    
    * Invoke unit tests with "-m twisted.trial" instead of "$(TRIAL)" to
      unbreak our code coverage reporting.
    
    * Use absolute paths for our translations because otherwise our new
      unit test invocation with "-m twisted.trial" would look in the wrong
      place and fail.
---
 .travis.requirements.txt              |  1 +
 .travis.yml                           | 26 +-------------------------
 Makefile                              |  2 +-
 bridgedb/distributors/https/server.py |  2 +-
 bridgedb/test/test_crypto.py          |  2 +-
 bridgedb/translations.py              |  2 +-
 requirements.txt                      |  2 +-
 scripts/install-dependencies          |  5 ++---
 8 files changed, 9 insertions(+), 33 deletions(-)

diff --git a/.travis.requirements.txt b/.travis.requirements.txt
index 9d69ab7..2f8d861 100644
--- a/.travis.requirements.txt
+++ b/.travis.requirements.txt
@@ -23,6 +23,7 @@ Mako==1.1.0
 ipaddr==2.2.0
 pygeoip==0.3.2
 PyCryptodome==3.9.0
+Twisted==19.7.0
 gnupg==2.3.1
 pillow==6.1.0
 qrcode==6.1
diff --git a/.travis.yml b/.travis.yml
index 9ec71fc..c0499b0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -32,30 +32,6 @@ env:
     #     https://stackoverflow.com/questions/2192323/what-is-the-python-egg-cache-python-egg-cache
     #     https://github.com/pypa/virtualenv/issues/459
     - PYTHON_EGG_CACHE="${HOME}/.python-eggs-$(echo $RANDOM$PPID$RANDOM | sha256sum | cut -d ' ' -f 1)"
-  matrix:
-    # What we're running on polyanthum
-    - TWISTED_VERSION=16.1.1 PYOPENSSL_VERSION=17.5.0
-    # Debian Stretch
-    - TWISTED_VERSION=16.6.0 PYOPENSSL_VERSION=17.5.0
-    # Debian experimental (all other versions of Debian have the same dependency versions right now)
-    - TWISTED_VERSION=17.1.0 PYOPENSSL_VERSION=17.5.0
-
-matrix:
-  include:
-    - python: "pypy"
-      env: TWISTED_VERSION=16.1.1 PYOPENSSL_VERSION=17.5.0
-    - python: "pypy"
-      env: TWISTED_VERSION=16.6.0 PYOPENSSL_VERSION=17.5.0
-  allow_failures:
-    - python: "2.7"
-      env: TWISTED_VERSION=16.6.0 PYOPENSSL_VERSION=17.5.0
-    - python: "2.7"
-      env: TWISTED_VERSION=17.1.0 PYOPENSSL_VERSION=17.5.0
-    - python: "pypy"
-      env: TWISTED_VERSION=16.1.1 PYOPENSSL_VERSION=17.5.0
-    - python: "pypy"
-      env: TWISTED_VERSION=16.6.0 PYOPENSSL_VERSION=17.5.0
-  fast_finish: true
 
 before_install:
   - sudo apt-get update
@@ -63,7 +39,7 @@ before_install:
   - chmod -R og-w $PYTHON_EGG_CACHE
 
 install:
-  - TWISTED_VERSION=$TWISTED_VERSION PYOPENSSL_VERSION=$PYOPENSSL_VERSION ./scripts/install-dependencies
+  - ./scripts/install-dependencies
   - make install
 
 # Start a BridgeDB instance before running the tests:
diff --git a/Makefile b/Makefile
index 428f004..08c2fbd 100644
--- a/Makefile
+++ b/Makefile
@@ -73,7 +73,7 @@ ifeq ($(PYTHON_IMPLEMENTATION),PyPy)
 	@echo "Detected PyPy... not running coverage."
 	python setup.py test
 else
-	coverage run --rcfile=".coveragerc" $(TRIAL) ./bridgedb/test/test_*.py
+	coverage run --rcfile=".coveragerc" -m twisted.trial ./bridgedb/test/test_*.py
 	coverage report --rcfile=".coveragerc"
 endif
 
diff --git a/bridgedb/distributors/https/server.py b/bridgedb/distributors/https/server.py
index e5df7da..81bc353 100644
--- a/bridgedb/distributors/https/server.py
+++ b/bridgedb/distributors/https/server.py
@@ -69,7 +69,7 @@ from bridgedb.util import replaceControlChars
 
 #: The path to the HTTPS distributor's web templates.  (Should be the
 #: "templates" directory in the same directory as this file.)
-TEMPLATE_DIR = os.path.join(os.path.dirname(__file__), 'templates')
+TEMPLATE_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'templates')
 
 # Setting `filesystem_checks` to False is recommended for production servers,
 # due to potential speed increases. This means that the atimes of the Mako
diff --git a/bridgedb/test/test_crypto.py b/bridgedb/test/test_crypto.py
index 10974bb..7a34671 100644
--- a/bridgedb/test/test_crypto.py
+++ b/bridgedb/test/test_crypto.py
@@ -329,7 +329,7 @@ class SSLVerifyingContextFactoryTests(unittest.TestCase,
 
     def setUp(self):
         """Create a fake reactor for these tests."""
-        self.reactor = self.Reactor()
+        self.reactor = self.createReactor()
         self.url = 'https://www.example.com/someresource.html#andatag'
 
     def test_getHostnameFromURL(self):
diff --git a/bridgedb/translations.py b/bridgedb/translations.py
index f3e6ed4..7429b60 100644
--- a/bridgedb/translations.py
+++ b/bridgedb/translations.py
@@ -17,7 +17,7 @@ from bridgedb import safelog
 from bridgedb.parse import headers
 
 
-TRANSLATIONS_DIR = os.path.join(os.path.dirname(__file__), 'i18n')
+TRANSLATIONS_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'i18n')
 
 
 def getFirstSupportedLang(langs):
diff --git a/requirements.txt b/requirements.txt
index 1b25a90..3bb970e 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,7 +1,7 @@
 Babel==2.7.0
 BeautifulSoup==3.2.1
 Mako==1.1.0
-Twisted==16.6.0
+Twisted==19.7.0
 ipaddr==2.2.0
 pyOpenSSL==19.0.0
 pygeoip==0.3.2
diff --git a/scripts/install-dependencies b/scripts/install-dependencies
index cffef18..923b51e 100755
--- a/scripts/install-dependencies
+++ b/scripts/install-dependencies
@@ -31,11 +31,10 @@ done
 
 $SUDO $APT_GET install ${APT_FLAGS} ${MISSING}
 
-# When running on Travis, be sure that environment variables are passed from
-# .travis.yml to this script:
+# When running on Travis, we are installing a few extra packages, e.g., to
+# determine code coverage.
 if [ "$TRAVIS" == "true" ] ; then
     $PIP install $PIP_FLAGS -r "$HERE/../.travis.requirements.txt"
-    $PIP install $PIP_FLAGS "Twisted==$TWISTED_VERSION" "pyOpenSSL==$PYOPENSSL_VERSION"
 else
     $PIP install $PIP_FLAGS -r "$HERE/../requirements.txt"
 fi



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits