Skip to content

Commit

Permalink
Changed logger info level in tests to ERROR (mozilla#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nebelhom committed Nov 18, 2013
1 parent 8250020 commit 53e0203
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 40 deletions.
11 changes: 7 additions & 4 deletions tests/base_scraper/test_base_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def test_download(self):
test_url = urljoin(self.wdir, 'download_test.txt')
scraper = mozdownload.DirectScraper(url=test_url,
directory=self.temp_dir,
version=None)
version=None,
log_level='ERROR')
scraper.download()
self.assertTrue(os.path.isfile(os.path.join(self.temp_dir,
filename)))
Expand All @@ -48,7 +49,8 @@ def test_download(self):
test_url1 = urljoin(self.wdir, 'does_not_exist.html')
scraper1 = mozdownload.DirectScraper(url=test_url1,
directory=self.temp_dir,
version=None)
version=None,
log_level='ERROR')
self.assertRaises(requests.exceptions.RequestException,
scraper1.download)

Expand All @@ -58,13 +60,14 @@ def test_download(self):
directory=self.temp_dir,
version=None,
retry_attempts=3,
retry_delay=1.0)
retry_delay=1.0,
log_level='ERROR')
self.assertRaises(requests.exceptions.RequestException,
scraper2.download)

def test_notimplementedexceptions(self):
scraper = mozdownload.Scraper(directory=self.temp_dir,
version=None)
version=None, log_level='ERROR')
for attr in ['binary', 'binary_regex', 'path_regex']:
self.assertRaises(mozdownload.NotImplementedError, getattr,
scraper, attr)
Expand Down
64 changes: 32 additions & 32 deletions tests/daily_scraper/test_daily_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,82 +17,82 @@
{'args': {'platform': 'win32'},
'target': '2013-10-01-03-02-04-mozilla-central-firefox-27.0a1.en-US.win32.installer.exe',
'target_url': 'firefox/nightly/2013/10/2013-10-01-03-02-04-mozilla-central/firefox-27.0a1.en-US.win32.installer.exe'
},
},

# -p win32 --branch=mozilla-central
{'args': {'platform': 'win32',
'branch': 'mozilla-central'},
'target': '2013-10-01-03-02-04-mozilla-central-firefox-27.0a1.en-US.win32.installer.exe',
'target_url': 'firefox/nightly/2013/10/2013-10-01-03-02-04-mozilla-central/firefox-27.0a1.en-US.win32.installer.exe'
},
},

# -p win64 --branch=mozilla-central
{'args': {'platform': 'win64',
'branch': 'mozilla-central'},
'target': '2013-10-01-03-02-04-mozilla-central-firefox-27.0a1.en-US.win64-x86_64.installer.exe',
'target_url': 'firefox/nightly/2013/10/2013-10-01-03-02-04-mozilla-central/firefox-27.0a1.en-US.win64-x86_64.installer.exe'
},
},

# -p linux --branch=mozilla-central
{'args': {'platform': 'linux',
'branch': 'mozilla-central'},
'branch': 'mozilla-central'},
'target': '2013-10-01-03-02-04-mozilla-central-firefox-27.0a1.en-US.linux-i686.tar.bz2',
'target_url': 'firefox/nightly/2013/10/2013-10-01-03-02-04-mozilla-central/firefox-27.0a1.en-US.linux-i686.tar.bz2'
},

# -p linux64 --branch=mozilla-central
{'args': {'platform': 'linux64',
'branch': 'mozilla-central'},
'branch': 'mozilla-central'},
'target': '2013-10-01-03-02-04-mozilla-central-firefox-27.0a1.en-US.linux-x86_64.tar.bz2',
'target_url': 'firefox/nightly/2013/10/2013-10-01-03-02-04-mozilla-central/firefox-27.0a1.en-US.linux-x86_64.tar.bz2'
},
},

# -p mac --branch=mozilla-central
{'args': {'platform': 'mac',
'branch': 'mozilla-central'},
'branch': 'mozilla-central'},
'target': '2013-10-01-03-02-04-mozilla-central-firefox-27.0a1.en-US.mac.dmg',
'target_url': 'firefox/nightly/2013/10/2013-10-01-03-02-04-mozilla-central/firefox-27.0a1.en-US.mac.dmg'
},
},

# -p linux --branch=mozilla-central --extension=txt
{'args': {'platform': 'linux',
'branch': 'mozilla-central',
'extension': 'txt'},
'target': '2013-10-01-03-02-04-mozilla-central-firefox-27.0a1.en-US.linux-i686.txt',
'target_url': 'firefox/nightly/2013/10/2013-10-01-03-02-04-mozilla-central/firefox-27.0a1.en-US.linux-i686.txt'
},
},

# -p win32 --branch=mozilla-central -l it
{'args': {'platform': 'win32',
'branch': 'mozilla-central',
'locale': 'it'},
'target': '2013-10-01-03-02-04-mozilla-central-firefox-27.0a1.it.win32.installer.exe',
'target_url': 'firefox/nightly/2013/10/2013-10-01-03-02-04-mozilla-central-l10n/firefox-27.0a1.it.win32.installer.exe'
},
},

# -p win32 --branch=mozilla-central -l sv-SE
{'args': {'platform': 'win32',
'branch': 'mozilla-central',
'locale': 'sv-SE'},
'target': '2013-10-01-03-02-04-mozilla-central-firefox-27.0a1.sv-SE.win32.installer.exe',
'target_url': 'firefox/nightly/2013/10/2013-10-01-03-02-04-mozilla-central-l10n/firefox-27.0a1.sv-SE.win32.installer.exe'
},
},

# -p win32 --branch=mozilla-central --build-id=20130706031213
{'args': {'platform': 'win32',
'branch': 'mozilla-central',
'build_id': '20130706031213'},
'target': '2013-07-06-03-12-13-mozilla-central-firefox-27.0a1.en-US.win32.installer.exe',
'target_url': 'firefox/nightly/2013/07/2013-07-06-03-12-13-mozilla-central/firefox-27.0a1.en-US.win32.installer.exe'
},
},

# -p win32 --branch=mozilla-central --date=2013-07-02
{'args': {'platform': 'win32',
'branch': 'mozilla-central',
'date': '2013-07-02'},
'target': '2013-07-02-04-12-13-mozilla-central-firefox-27.0a1.en-US.win32.installer.exe',
'target_url': 'firefox/nightly/2013/07/2013-07-02-04-12-13-mozilla-central/firefox-27.0a1.en-US.win32.installer.exe'
},
},

# -p win32 --branch=mozilla-central --date=2013-07-02 --build-number=1
{'args': {'platform': 'win32',
Expand All @@ -101,29 +101,29 @@
'build_number': 1},
'target': '2013-07-02-03-12-13-mozilla-central-firefox-27.0a1.en-US.win32.installer.exe',
'target_url': 'firefox/nightly/2013/07/2013-07-02-03-12-13-mozilla-central/firefox-27.0a1.en-US.win32.installer.exe'
},
},

# -p win32 --branch=mozilla-central --stub
{'args': {'platform': 'win32',
'branch': 'mozilla-central',
'is_stub_installer': True},
'target': '2013-10-01-03-02-04-mozilla-central-firefox-27.0a1.en-US.win32.installer-stub.exe',
'target_url': 'firefox/nightly/2013/10/2013-10-01-03-02-04-mozilla-central/firefox-27.0a1.en-US.win32.installer-stub.exe'
},
},

# -p win32 --branch=mozilla-aurora
{'args': {'platform': 'win32',
'branch': 'mozilla-aurora'},
'target': '2013-10-01-03-02-04-mozilla-aurora-firefox-27.0a1.en-US.win32.installer.exe',
'target_url': 'firefox/nightly/2013/10/2013-10-01-03-02-04-mozilla-aurora/firefox-27.0a1.en-US.win32.installer.exe'
},
},

# -p win32 --branch=ux
{'args': {'platform': 'win32',
'branch': 'ux'},
'target': '2013-10-01-03-02-04-ux-firefox-27.0a1.en-US.win32.installer.exe',
'target_url': 'firefox/nightly/2013/10/2013-10-01-03-02-04-ux/firefox-27.0a1.en-US.win32.installer.exe'
},
},
]

thunderbird_tests = [
Expand All @@ -133,39 +133,39 @@
'branch': 'comm-central'},
'target': '2013-10-01-03-02-04-comm-central-thunderbird-27.0a1.en-US.linux-i686.tar.bz2',
'target_url': 'thunderbird/nightly/2013/10/2013-10-01-03-02-04-comm-central/thunderbird-27.0a1.en-US.linux-i686.tar.bz2'
},
},

# -p linux64 --branch=comm-central
{'args': {'application': 'thunderbird',
'platform': 'linux64',
'branch': 'comm-central'},
'target': '2013-10-01-03-02-04-comm-central-thunderbird-27.0a1.en-US.linux-x86_64.tar.bz2',
'target_url': 'thunderbird/nightly/2013/10/2013-10-01-03-02-04-comm-central/thunderbird-27.0a1.en-US.linux-x86_64.tar.bz2'
},
},

# -p mac --branch=comm-central
{'args': {'application': 'thunderbird',
'platform': 'mac',
'branch': 'comm-central'},
'target': '2013-10-01-03-02-04-comm-central-thunderbird-27.0a1.en-US.mac.dmg',
'target_url': 'thunderbird/nightly/2013/10/2013-10-01-03-02-04-comm-central/thunderbird-27.0a1.en-US.mac.dmg'
},
},

# -p win32 --branch=comm-central
{'args': {'application': 'thunderbird',
'platform': 'win32',
'branch': 'comm-central'},
'target': '2013-10-01-03-02-04-comm-central-thunderbird-27.0a1.en-US.win32.installer.exe',
'target_url': 'thunderbird/nightly/2013/10/2013-10-01-03-02-04-comm-central/thunderbird-27.0a1.en-US.win32.installer.exe'
},
},

# -p win64 --branch=comm-central
{'args': {'application': 'thunderbird',
'platform': 'win64',
'branch': 'comm-central'},
'target': '2013-10-01-03-02-04-comm-central-thunderbird-27.0a1.en-US.win64-x86_64.installer.exe',
'target_url': 'thunderbird/nightly/2013/10/2013-10-01-03-02-04-comm-central/thunderbird-27.0a1.en-US.win64-x86_64.installer.exe'
},
},

# -p linux --branch=comm-central --extension=txt
{'args': {'application': 'thunderbird',
Expand All @@ -174,7 +174,7 @@
'extension': 'txt'},
'target': '2013-10-01-03-02-04-comm-central-thunderbird-27.0a1.en-US.linux-i686.txt',
'target_url': 'thunderbird/nightly/2013/10/2013-10-01-03-02-04-comm-central/thunderbird-27.0a1.en-US.linux-i686.txt'
},
},

# -p win32 --branch=comm-central -l it
{'args': {'application': 'thunderbird',
Expand All @@ -183,7 +183,7 @@
'locale': 'it'},
'target': '2013-10-01-03-02-04-comm-central-thunderbird-27.0a1.it.win32.installer.exe',
'target_url': 'thunderbird/nightly/2013/10/2013-10-01-03-02-04-comm-central-l10n/thunderbird-27.0a1.it.win32.installer.exe'
},
},

# -p win32 --branch=comm-central -l sv-SE
{'args': {'application': 'thunderbird',
Expand All @@ -192,7 +192,7 @@
'locale': 'sv-SE'},
'target': '2013-10-01-03-02-04-comm-central-thunderbird-27.0a1.sv-SE.win32.installer.exe',
'target_url': 'thunderbird/nightly/2013/10/2013-10-01-03-02-04-comm-central-l10n/thunderbird-27.0a1.sv-SE.win32.installer.exe'
},
},

# -p win32 --branch=comm-central --build-id=20130710110153
{'args': {'application': 'thunderbird',
Expand All @@ -201,7 +201,7 @@
'build_id': '20130710110153'},
'target': '2013-07-10-11-01-53-comm-central-thunderbird-27.0a1.en-US.win32.installer.exe',
'target_url': 'thunderbird/nightly/2013/07/2013-07-10-11-01-53-comm-central/thunderbird-27.0a1.en-US.win32.installer.exe'
},
},

# -p win32 --branch=comm-central --date=2013-07-10
{'args': {'application': 'thunderbird',
Expand All @@ -210,7 +210,7 @@
'date': '2013-07-10'},
'target': '2013-07-10-11-01-53-comm-central-thunderbird-27.0a1.en-US.win32.installer.exe',
'target_url': 'thunderbird/nightly/2013/07/2013-07-10-11-01-53-comm-central/thunderbird-27.0a1.en-US.win32.installer.exe'
},
},

# -p win32 --branch=comm-central --date=2013-07-10 --build-number=1
{'args': {'application': 'thunderbird',
Expand All @@ -220,15 +220,15 @@
'build_number': 1},
'target': '2013-07-10-10-01-53-comm-central-thunderbird-27.0a1.en-US.win32.installer.exe',
'target_url': 'thunderbird/nightly/2013/07/2013-07-10-10-01-53-comm-central/thunderbird-27.0a1.en-US.win32.installer.exe'
},
},

# -p win32 --branch=comm-central
{'args': {'application': 'thunderbird',
'platform': 'win32',
'branch': 'comm-aurora'},
'target': '2013-10-01-03-02-04-comm-aurora-thunderbird-27.0a1.en-US.win32.installer.exe',
'target_url': 'thunderbird/nightly/2013/10/2013-10-01-03-02-04-comm-aurora/thunderbird-27.0a1.en-US.win32.installer.exe'
},
},
]

tests = firefox_tests + thunderbird_tests
Expand All @@ -242,12 +242,12 @@ def test_scraper(self):

for entry in tests:
scraper = DailyScraper(directory=self.temp_dir, base_url=self.wdir,
version=None, **entry['args'])
version=None, log_level='ERROR',
**entry['args'])
expected_target = os.path.join(self.temp_dir, entry['target'])
self.assertEqual(scraper.target, expected_target)
self.assertEqual(urllib.unquote(scraper.final_url),
urljoin(self.wdir, entry['target_url']))

urljoin(self.wdir, entry['target_url']))

if __name__ == '__main__':
unittest.main()
3 changes: 2 additions & 1 deletion tests/direct_scraper/test_direct_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def test_url_download(self):
test_url = 'https://mozqa.com/index.html'
scraper = DirectScraper(url=test_url,
directory=self.temp_dir,
version=None)
version=None,
log_level='ERROR')
self.assertEqual(scraper.url, test_url)
self.assertEqual(scraper.final_url, test_url)
self.assertEqual(scraper.target,
Expand Down
2 changes: 1 addition & 1 deletion tests/mozhttpd_base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class MozHttpdBaseTest(unittest.TestCase):
def setUp(self):
"""Starts server that lists all files in the directory"""
self.logger = mozlog.getLogger(self.__class__.__name__)
self.logger.setLevel('INFO')
self.logger.setLevel('ERROR')
self.httpd = mozhttpd.MozHttpd(port=8080, docroot=HERE,
urlhandlers=[{'method': 'GET',
'path': '/api/resources/([^/]+)/?',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ def test_scraper(self):
for entry in tests:
scraper = ReleaseCandidateScraper(directory=self.temp_dir,
base_url=self.wdir,
log_level='ERROR',
**entry['args'])
expected_target = os.path.join(self.temp_dir, entry['target'])
self.assertEqual(scraper.target, expected_target)
Expand Down
2 changes: 1 addition & 1 deletion tests/release_scraper/test_release_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def test_scraper(self):

for entry in tests:
scraper = ReleaseScraper(directory=self.temp_dir, base_url=self.wdir,
**entry['args'])
log_level='ERROR', **entry['args'])
expected_target = os.path.join(self.temp_dir, entry['target'])
self.assertEqual(scraper.target, expected_target)
self.assertEqual(urllib.unquote(scraper.final_url),
Expand Down
3 changes: 2 additions & 1 deletion tests/tinderbox_scraper/test_tinderbox_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ def test_scraper(self):

for entry in tests:
scraper = TinderboxScraper(directory=self.temp_dir, version=None,
base_url=self.wdir, **entry['args'])
base_url=self.wdir, log_level='ERROR',
**entry['args'])
expected_target = os.path.join(self.temp_dir, entry['target'])
self.assertEqual(scraper.target, expected_target)
self.assertEqual(urllib.unquote(scraper.final_url),
Expand Down

0 comments on commit 53e0203

Please sign in to comment.