[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#847555: tracker.debian.org: Functional testing suite seems broken



Package: tracker.debian.org
Severity: normal
Tags: patch

Dear Maintainer,

I wanted to work on some fixes for tracker.d.o. so i setup a stable kvm for better isolation but the functional
test suite seemed broken. Also the docs were missing the reference
to the driver.

I looked for the driver but it was not on stable/main so went for chromedriver. And the situation improved considireously. Then realized that improper method was used for closing the driver, leading to undesired spwaning of driver processes.

bests,

efkin.

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.8.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
>From fb1098e4f74ef5a225b0dfc5fd206b06a8b33d21 Mon Sep 17 00:00:00 2001
From: efkin <efkin@riseup.net>
Date: Fri, 9 Dec 2016 11:44:00 +0100
Subject: [PATCH 1/2] Use chromedriver instead of firefoxdriver

The testing suite should be executable from within
debian stable.
---
 docs/setup/setup.rst      | 5 ++++-
 functional_tests/tests.py | 7 ++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/docs/setup/setup.rst b/docs/setup/setup.rst
index eb0d116..9a4810c 100644
--- a/docs/setup/setup.rst
+++ b/docs/setup/setup.rst
@@ -24,6 +24,9 @@ Distro Tracker currently depends on the following Debian packages:
 - python-soappy (optional)
 - python-ldap (optional)
 - python-tox (for development only)
+- python-selenium (for development only)
+- chromedriver (for development only)
+- chromium (for development only)
 
 For Python2.7, the following additional packages are required:
 
@@ -32,7 +35,7 @@ For Python2.7, the following additional packages are required:
 
 Here is the list of required packages for development on Debian Jessie::
 
- $ sudo aptitude install python-django python-requests python-django-jsonfield python-django-debug-toolbar python-debian python-apt python-gpgme python-yaml python-bs4 python-soappy python-ldap python-pyinotify python-tox python-mock python-lzma python3-django python3-requests python3-django-jsonfield python3-django-debug-toolbar python3-debian python3-apt python3-gpgme python3-yaml python3-bs4 python3-pyinotify
+ $ sudo aptitude install python-django python-requests python-django-jsonfield python-django-debug-toolbar python-debian python-apt python-gpgme python-yaml python-bs4 python-soappy python-ldap python-pyinotify python-tox python-mock python-lzma python-selenium python3-django python3-requests python3-django-jsonfield python3-django-debug-toolbar python3-debian python3-apt python3-gpgme python3-yaml python3-bs4 python3-pyinotify python3-selenium chromium chromedriver
 
 .. _database_setup:
 
diff --git a/functional_tests/tests.py b/functional_tests/tests.py
index 5f60290..734fd67 100644
--- a/functional_tests/tests.py
+++ b/functional_tests/tests.py
@@ -46,9 +46,10 @@ class SeleniumTestCase(LiveServerTestCase):
     """
     def setUp(self):
         os.environ['NO_PROXY'] = 'localhost,127.0.0.1,127.0.1.1'
-        fp = webdriver.FirefoxProfile()
-        fp.set_preference('network.proxy.type', 0)
-        self.browser = webdriver.Firefox(firefox_profile=fp)
+
+        chromedriver = "/usr/lib/chromium/chromedriver"
+        os.environ["webdriver.chrome.driver"] = chromedriver
+        self.browser = webdriver.Chrome(chromedriver)
         self.browser.implicitly_wait(3)
         self.browser.set_page_load_timeout(3)
         self.browser.set_script_timeout(3)
-- 
2.1.4

>From c74e362d9168a80d58ad2d1d20e1a3e4844c1945 Mon Sep 17 00:00:00 2001
From: efkin <efkin@riseup.net>
Date: Fri, 9 Dec 2016 11:46:48 +0100
Subject: [PATCH 2/2] Selenium spawning too many driver's processes

According to documentation .quit() is the proper method
to close all existing tabs and exit the process.
---
 functional_tests/tests.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/functional_tests/tests.py b/functional_tests/tests.py
index 734fd67..85689aa 100644
--- a/functional_tests/tests.py
+++ b/functional_tests/tests.py
@@ -55,7 +55,7 @@ class SeleniumTestCase(LiveServerTestCase):
         self.browser.set_script_timeout(3)
 
     def tearDown(self):
-        self.browser.close()
+        self.browser.quit()
 
     def get_page(self, relative):
         """
-- 
2.1.4


Reply to: