[tor-commits] [translation/vidalia_alpha] Update translations for vidalia_alpha

2014-01-05 Thread translation
commit 0d330f810f1be603c0afddf2aa18606ea5c49b60
Author: Translation commit bot translat...@torproject.org
Date:   Sun Jan 5 14:45:19 2014 +

Update translations for vidalia_alpha
---
 fr_CA/vidalia_fr_CA.po |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fr_CA/vidalia_fr_CA.po b/fr_CA/vidalia_fr_CA.po
index d3f0ebb..e15afc1 100644
--- a/fr_CA/vidalia_fr_CA.po
+++ b/fr_CA/vidalia_fr_CA.po
@@ -5,7 +5,7 @@ msgstr 
 Project-Id-Version: The Tor Project\n
 Report-Msgid-Bugs-To: translati...@vidalia-project.net\n
 POT-Creation-Date: 2012-03-21 17:46+\n
-PO-Revision-Date: 2014-01-02 17:00+\n
+PO-Revision-Date: 2014-01-05 14:40+\n
 Last-Translator: Phoul co...@torproject.org\n
 Language-Team: French (Canada) 
(http://www.transifex.com/projects/p/torproject/language/fr_CA/)\n
 MIME-Version: 1.0\n
@@ -1733,7 +1733,7 @@ msgstr 
 
 msgctxt MainWindow
 msgid Connecting to the Tor network
-msgstr 
+msgstr Connexion au réseau Tor
 
 msgctxt MainWindow
 msgid Establishing a Tor circuit
@@ -3516,7 +3516,7 @@ msgstr 
 
 msgctxt StatusTab
 msgid Tor Status
-msgstr 
+msgstr État de Tor
 
 msgctxt StatusTab
 msgid Show on startup

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


[tor-commits] [translation/vidalia] Update translations for vidalia

2014-01-05 Thread translation
commit e1dc2c904a528461ccd0fc5c62923e29e8c2805f
Author: Translation commit bot translat...@torproject.org
Date:   Sun Jan 5 14:45:12 2014 +

Update translations for vidalia
---
 fr_CA/vidalia_fr_CA.po |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fr_CA/vidalia_fr_CA.po b/fr_CA/vidalia_fr_CA.po
index 7812551..21f1d49 100644
--- a/fr_CA/vidalia_fr_CA.po
+++ b/fr_CA/vidalia_fr_CA.po
@@ -5,7 +5,7 @@ msgstr 
 Project-Id-Version: The Tor Project\n
 Report-Msgid-Bugs-To: https://trac.torproject.org/projects/tor\n;
 POT-Creation-Date: 2012-03-21 17:52+\n
-PO-Revision-Date: 2014-01-02 17:00+\n
+PO-Revision-Date: 2014-01-05 14:40+\n
 Last-Translator: Phoul co...@torproject.org\n
 Language-Team: French (Canada) 
(http://www.transifex.com/projects/p/torproject/language/fr_CA/)\n
 MIME-Version: 1.0\n
@@ -1761,7 +1761,7 @@ msgstr 
 
 msgctxt MainWindow
 msgid Connecting to the Tor network
-msgstr 
+msgstr Connexion au réseau Tor
 
 msgctxt MainWindow
 msgid Establishing a Tor circuit
@@ -2397,7 +2397,7 @@ msgstr 
 
 msgctxt MessageLog
 msgid Tor Status
-msgstr 
+msgstr État de Tor
 
 msgctxt MessageLog
 msgid Advanced

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


[tor-commits] [translation/torbirdy_completed] Update translations for torbirdy_completed

2014-01-05 Thread translation
commit c45739b17ef1026d49397ae05b4de5e94eeacc3a
Author: Translation commit bot translat...@torproject.org
Date:   Sun Jan 5 14:46:11 2014 +

Update translations for torbirdy_completed
---
 fr_CA/torbirdy.properties |   19 +++
 1 file changed, 19 insertions(+)

diff --git a/fr_CA/torbirdy.properties b/fr_CA/torbirdy.properties
new file mode 100644
index 000..081da3a
--- /dev/null
+++ b/fr_CA/torbirdy.properties
@@ -0,0 +1,19 @@
+torbirdy.name=TorBirdy
+
+torbirdy.enabled.tor=Activé avec TorBirdy : Tor
+torbirdy.enabled.jondo=Activé avec TorBirdy : JonDo
+torbirdy.enabled.custom=Activé avec TorBirdy : mandataire personnalisé
+torbirdy.enabled.torification=Activé avec TorBirdy : torification transparente
+torbirdy.enabled.whonix=Activé avec TorBirdy : Whonix
+torbirdy.disabled=TorBirdy : désactivé!
+
+torbirdy.email.prompt=TorBirdy a désactivé l'auto-configuration de 
Thunderbird pour protéger votre anonymat.\n\nLes paramètres de sécurité 
recommandé pour %S on été définis.\n\nVous pouvez maintenant configurer les 
paramètres de l'autre compte manuellement.
+
+torbirdy.email.advanced=Veuillez noter qu'il n'est PAS recommandé de modifier 
les paramètres avancés de TorBirdy.\n\nVous ne devriez continuer que si vous 
êtes sur de ce que vous faites.
+torbirdy.email.advanced.nextwarning=Afficher cet avertissement la prochaine 
fois
+torbirdy.email.advanced.title=Paramètres avancés de TorBirdy
+
+torbirdy.restart=Vous devez redémarrer Thunderbird pour que les préférences 
de fuseau horaire prennent effet.
+
+torbirdy.firstrun=TorBirdy est maintenant en cours d'exécution.\n\nPour vous 
aider à protéger votre anonymat, TorBirdy va appliquer les paramètres de 
Thunderbird qu'il a configuré, les empêchant d'être modifiés par vous-même 
ou tout autre module complémentaire. Il y a certains paramètres qui peuvent 
être changés et ceux-ci sont accessibles par le biais de la boîte de 
dialogue de TorBirdy. Lorsque TorBirdy est désinstallé ou désactivé, tous 
les paramètres qu'il a modifié sont réinitialisés à leurs valeurs par 
défaut (valeurs avant l'installation de TorBirdy).\n\nSi vous êtes un nouvel 
utilisateur, il vous est conseillé de lire le site Internet de TorBirdy afin 
de comprendre ce que nous essayons d'accomplir avec TorBirdy pour nos 
utilisateurs.
+torbirdy.website=https://trac.torproject.org/projects/tor/wiki/torbirdy

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


[tor-commits] [translation/torbirdy] Update translations for torbirdy

2014-01-05 Thread translation
commit eaaa76662561a65bff1591bd04f54081f6bcf92f
Author: Translation commit bot translat...@torproject.org
Date:   Sun Jan 5 14:46:08 2014 +

Update translations for torbirdy
---
 fr_CA/torbirdy.properties |   28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/fr_CA/torbirdy.properties b/fr_CA/torbirdy.properties
index b999de2..081da3a 100644
--- a/fr_CA/torbirdy.properties
+++ b/fr_CA/torbirdy.properties
@@ -1,19 +1,19 @@
-# torbirdy.name=TorBirdy
+torbirdy.name=TorBirdy
 
-# torbirdy.enabled.tor=TorBirdy Enabled:Tor
-# torbirdy.enabled.jondo=TorBirdy Enabled:JonDo
-# torbirdy.enabled.custom=TorBirdy Enabled:Custom Proxy
-# torbirdy.enabled.torification=TorBirdy Enabled:Transparent Torification
-# torbirdy.enabled.whonix=TorBirdy Enabled:Whonix
-# torbirdy.disabled=TorBirdy:Disabled!
+torbirdy.enabled.tor=Activé avec TorBirdy : Tor
+torbirdy.enabled.jondo=Activé avec TorBirdy : JonDo
+torbirdy.enabled.custom=Activé avec TorBirdy : mandataire personnalisé
+torbirdy.enabled.torification=Activé avec TorBirdy : torification transparente
+torbirdy.enabled.whonix=Activé avec TorBirdy : Whonix
+torbirdy.disabled=TorBirdy : désactivé!
 
-# torbirdy.email.prompt=TorBirdy has disabled Thunderbird's auto-configuration 
wizard to protect your anonymity.\n\nThe recommended security settings for %S 
have been set.\n\nYou can now configure the other account settings manually.
+torbirdy.email.prompt=TorBirdy a désactivé l'auto-configuration de 
Thunderbird pour protéger votre anonymat.\n\nLes paramètres de sécurité 
recommandé pour %S on été définis.\n\nVous pouvez maintenant configurer les 
paramètres de l'autre compte manuellement.
 
-# torbirdy.email.advanced=Please note that changing the advanced settings of 
TorBirdy is NOT recommended.\n\nYou should only continue if you are sure of 
what you are doing.
-# torbirdy.email.advanced.nextwarning=Show this warning next time
-# torbirdy.email.advanced.title=TorBirdy Advanced Settings
+torbirdy.email.advanced=Veuillez noter qu'il n'est PAS recommandé de modifier 
les paramètres avancés de TorBirdy.\n\nVous ne devriez continuer que si vous 
êtes sur de ce que vous faites.
+torbirdy.email.advanced.nextwarning=Afficher cet avertissement la prochaine 
fois
+torbirdy.email.advanced.title=Paramètres avancés de TorBirdy
 
-# torbirdy.restart=You must restart Thunderbird for the time zone preference 
to take effect.
+torbirdy.restart=Vous devez redémarrer Thunderbird pour que les préférences 
de fuseau horaire prennent effet.
 
-# torbirdy.firstrun=You are now running TorBirdy.\n\nTo help protect your 
anonymity, TorBirdy will enforce the Thunderbird settings it has set, 
preventing them from being changed by you or by any add-on. There are some 
settings that can be changed and those are accessed through TorBirdy's 
preferences dialog. When TorBirdy is uninstalled or disabled, all settings that 
it changes are reset to their default values (the values prior to TorBirdy's 
install).\n\nIf you are a new user, it is recommended that you read through the 
TorBirdy website to understand what we are trying to accomplish with TorBirdy 
for our users.
-# torbirdy.website=https://trac.torproject.org/projects/tor/wiki/torbirdy
+torbirdy.firstrun=TorBirdy est maintenant en cours d'exécution.\n\nPour vous 
aider à protéger votre anonymat, TorBirdy va appliquer les paramètres de 
Thunderbird qu'il a configuré, les empêchant d'être modifiés par vous-même 
ou tout autre module complémentaire. Il y a certains paramètres qui peuvent 
être changés et ceux-ci sont accessibles par le biais de la boîte de 
dialogue de TorBirdy. Lorsque TorBirdy est désinstallé ou désactivé, tous 
les paramètres qu'il a modifié sont réinitialisés à leurs valeurs par 
défaut (valeurs avant l'installation de TorBirdy).\n\nSi vous êtes un nouvel 
utilisateur, il vous est conseillé de lire le site Internet de TorBirdy afin 
de comprendre ce que nous essayons d'accomplir avec TorBirdy pour nos 
utilisateurs.
+torbirdy.website=https://trac.torproject.org/projects/tor/wiki/torbirdy

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


[tor-commits] [translation/torbutton-brandproperties] Update translations for torbutton-brandproperties

2014-01-05 Thread translation
commit e4807f2c1d5397ecd42f163649532f5b1d3e4cc1
Author: Translation commit bot translat...@torproject.org
Date:   Sun Jan 5 14:46:28 2014 +

Update translations for torbutton-brandproperties
---
 fr_CA/brand.properties |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/fr_CA/brand.properties b/fr_CA/brand.properties
index 6598ccd..a2b4b38 100644
--- a/fr_CA/brand.properties
+++ b/fr_CA/brand.properties
@@ -2,14 +2,14 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-# brandShortName=TorBrowser
-# brandFullName=Tor Browser
-# vendorShortName=Tor Project
+brandShortName=Navigateur Tor
+brandFullName=Navigateur Tor
+vendorShortName=Projet Tor
 
-# homePageSingleStartMain=Firefox Start, a fast home page with built-in search
-# homePageImport=Import your home page from %S
+homePageSingleStartMain=Firefox Start, une page d'accueil rapide avec 
recherche intégrée
+homePageImport=Importez votre page d'accueil à partir de %S
 
-# homePageMigrationPageTitle=Home Page Selection
-# homePageMigrationDescription=Please select the home page you wish to use:
+homePageMigrationPageTitle=Choix de la page d'accueil
+homePageMigrationDescription=Veuillez choisir la page d'accueil que vous 
souhaitez utiliser :
 
-# syncBrandShortName=Sync
+syncBrandShortName=Sync

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


[tor-commits] [translation/torbutton-branddtd] Update translations for torbutton-branddtd

2014-01-05 Thread translation
commit 64a5398dd864dccc70c80ef7de5d1950fc00a98a
Author: Translation commit bot translat...@torproject.org
Date:   Sun Jan 5 14:46:33 2014 +

Update translations for torbutton-branddtd
---
 fr_CA/brand.dtd |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fr_CA/brand.dtd b/fr_CA/brand.dtd
index 76e405d..775472a 100644
--- a/fr_CA/brand.dtd
+++ b/fr_CA/brand.dtd
@@ -2,7 +2,7 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --
 
-!ENTITY  brandShortNameTorBrowser
-!ENTITY  brandFullName Tor Browser
-!ENTITY  vendorShortName   Tor Project
-!ENTITY  trademarkInfo.part1   Firefox and the Firefox logos are trademarks 
of the Mozilla Foundation.
+!ENTITY  brandShortNameNavigateur Tor
+!ENTITY  brandFullName Navigateur Tor
+!ENTITY  vendorShortName   Projet Tor
+!ENTITY  trademarkInfo.part1   Firefox et les logos de Firefox sont des 
marques déposées de la Fondation Mozilla.

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


[tor-commits] [translation/torbutton-branddtd_completed] Update translations for torbutton-branddtd_completed

2014-01-05 Thread translation
commit f70719b4ef267d96e5570e04287c85ca5f1674b0
Author: Translation commit bot translat...@torproject.org
Date:   Sun Jan 5 14:46:35 2014 +

Update translations for torbutton-branddtd_completed
---
 fr_CA/brand.dtd |8 
 1 file changed, 8 insertions(+)

diff --git a/fr_CA/brand.dtd b/fr_CA/brand.dtd
new file mode 100644
index 000..775472a
--- /dev/null
+++ b/fr_CA/brand.dtd
@@ -0,0 +1,8 @@
+!-- This Source Code Form is subject to the terms of the Mozilla Public
+   - License, v. 2.0. If a copy of the MPL was not distributed with this
+   - file, You can obtain one at http://mozilla.org/MPL/2.0/. --
+
+!ENTITY  brandShortNameNavigateur Tor
+!ENTITY  brandFullName Navigateur Tor
+!ENTITY  vendorShortName   Projet Tor
+!ENTITY  trademarkInfo.part1   Firefox et les logos de Firefox sont des 
marques déposées de la Fondation Mozilla.

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


[tor-commits] [translation/torbutton-brandproperties_completed] Update translations for torbutton-brandproperties_completed

2014-01-05 Thread translation
commit fe5dcd9d8cbc20df62e8d2474c191a222069ffe6
Author: Translation commit bot translat...@torproject.org
Date:   Sun Jan 5 14:46:31 2014 +

Update translations for torbutton-brandproperties_completed
---
 fr_CA/brand.properties |   15 +++
 1 file changed, 15 insertions(+)

diff --git a/fr_CA/brand.properties b/fr_CA/brand.properties
new file mode 100644
index 000..a2b4b38
--- /dev/null
+++ b/fr_CA/brand.properties
@@ -0,0 +1,15 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+brandShortName=Navigateur Tor
+brandFullName=Navigateur Tor
+vendorShortName=Projet Tor
+
+homePageSingleStartMain=Firefox Start, une page d'accueil rapide avec 
recherche intégrée
+homePageImport=Importez votre page d'accueil à partir de %S
+
+homePageMigrationPageTitle=Choix de la page d'accueil
+homePageMigrationDescription=Veuillez choisir la page d'accueil que vous 
souhaitez utiliser :
+
+syncBrandShortName=Sync

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


[tor-commits] [translation/vidalia] Update translations for vidalia

2014-01-05 Thread translation
commit a01f47280f1a7e24d3987b71dd9ecb73a9a7e670
Author: Translation commit bot translat...@torproject.org
Date:   Sun Jan 5 15:15:14 2014 +

Update translations for vidalia
---
 fr_CA/vidalia_fr_CA.po |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fr_CA/vidalia_fr_CA.po b/fr_CA/vidalia_fr_CA.po
index 21f1d49..5a54463 100644
--- a/fr_CA/vidalia_fr_CA.po
+++ b/fr_CA/vidalia_fr_CA.po
@@ -5,7 +5,7 @@ msgstr 
 Project-Id-Version: The Tor Project\n
 Report-Msgid-Bugs-To: https://trac.torproject.org/projects/tor\n;
 POT-Creation-Date: 2012-03-21 17:52+\n
-PO-Revision-Date: 2014-01-05 14:40+\n
+PO-Revision-Date: 2014-01-05 14:50+\n
 Last-Translator: Phoul co...@torproject.org\n
 Language-Team: French (Canada) 
(http://www.transifex.com/projects/p/torproject/language/fr_CA/)\n
 MIME-Version: 1.0\n

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


[tor-commits] [translation/vidalia_alpha] Update translations for vidalia_alpha

2014-01-05 Thread translation
commit 4fb7eca64d75af75db6ade24b45eaf621110e952
Author: Translation commit bot translat...@torproject.org
Date:   Sun Jan 5 15:15:19 2014 +

Update translations for vidalia_alpha
---
 fr_CA/vidalia_fr_CA.po |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fr_CA/vidalia_fr_CA.po b/fr_CA/vidalia_fr_CA.po
index e15afc1..8977a63 100644
--- a/fr_CA/vidalia_fr_CA.po
+++ b/fr_CA/vidalia_fr_CA.po
@@ -5,7 +5,7 @@ msgstr 
 Project-Id-Version: The Tor Project\n
 Report-Msgid-Bugs-To: translati...@vidalia-project.net\n
 POT-Creation-Date: 2012-03-21 17:46+\n
-PO-Revision-Date: 2014-01-05 14:40+\n
+PO-Revision-Date: 2014-01-05 14:50+\n
 Last-Translator: Phoul co...@torproject.org\n
 Language-Team: French (Canada) 
(http://www.transifex.com/projects/p/torproject/language/fr_CA/)\n
 MIME-Version: 1.0\n

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


[tor-commits] [stem/master] Style issues suppressed pyflakes results

2014-01-05 Thread atagar
commit 46bfcad588b7e41cff109d72ea7a88717beb2c00
Author: Damian Johnson ata...@torproject.org
Date:   Sun Jan 5 11:05:27 2014 -0800

Style issues suppressed pyflakes results

When both pyflakes and pep8 reported issues about a file the pep8 results
clobbered the pyflakes output. Properly combining the two instead.
---
 run_tests.py |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/run_tests.py b/run_tests.py
index 664df35..90493da 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -293,12 +293,16 @@ def main():
 static_check_issues = {}
 
 if pyflakes_task and pyflakes_task.is_successful:
-  static_check_issues.update(pyflakes_task.result)
+  for path, issues in pyflakes_task.result.items():
+for issue in issues:
+  static_check_issues.setdefault(path, []).append(issue)
 elif not test.util.is_pyflakes_available():
   println(Static error checking requires pyflakes version 0.7.3 or later. 
Please install it from ...\n  http://pypi.python.org/pypi/pyflakes\n;, ERROR)
 
 if pep8_task and pep8_task.is_successful:
-  static_check_issues.update(pep8_task.result)
+  for path, issues in pep8_task.result.items():
+for issue in issues:
+  static_check_issues.setdefault(path, []).append(issue)
 elif not test.util.is_pep8_available():
   println(Style checks require pep8 version 1.4.2 or later. Please 
install it from...\n  http://pypi.python.org/pypi/pep8\n;, ERROR)
 

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


[tor-commits] [arm/master] Initial Daemon unit tests

2014-01-05 Thread atagar
commit 511c7ac98f13bf7b0817ab759d331a65424472f6
Author: Damian Johnson ata...@torproject.org
Date:   Sun Jan 5 14:38:28 2014 -0800

Initial Daemon unit tests

Few simple tests for its initialization. Further testing for the Daemon and
subclasses in the tracker module coming soon.

As for the load_test() test, it's both for a helper that no longer exists 
and
the test wasn't being run due to not having an __init__.py.
---
 arm/util/tracker.py   |3 ++-
 run_tests.py  |8 +--
 test/starter/load_settings.py |   31 ---
 test/util/tracker/daemon.py   |   47 +
 4 files changed, 55 insertions(+), 34 deletions(-)

diff --git a/arm/util/tracker.py b/arm/util/tracker.py
index 476b11e..8febb12 100644
--- a/arm/util/tracker.py
+++ b/arm/util/tracker.py
@@ -1,5 +1,5 @@
 
-Background tasks for gathering informatino about the tor process.
+Background tasks for gathering information about the tor process.
 
 ::
 
@@ -108,6 +108,7 @@ def stop_trackers():
   tracker.join()
 
   halt_thread = threading.Thread(target = halt_trackers)
+  halt_thread.setDaemon(True)
   halt_thread.start()
   return halt_thread
 
diff --git a/run_tests.py b/run_tests.py
index 324ed02..1553da8 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -48,10 +48,14 @@ def main():
   static_check_issues = {}
 
   if is_pyflakes_available():
-static_check_issues.update(get_pyflakes_issues(SRC_PATHS))
+for path, issues in get_pyflakes_issues(SRC_PATHS).items():
+  for issue in issues:
+static_check_issues.setdefault(path, []).append(issue)
 
   if is_pep8_available():
-static_check_issues.update(get_stylistic_issues(SRC_PATHS))
+for path, issues in get_stylistic_issues(SRC_PATHS).items():
+  for issue in issues:
+static_check_issues.setdefault(path, []).append(issue)
 
   if static_check_issues:
 print STATIC CHECKS
diff --git a/test/starter/load_settings.py b/test/starter/load_settings.py
deleted file mode 100644
index 5c9cfd8..000
--- a/test/starter/load_settings.py
+++ /dev/null
@@ -1,31 +0,0 @@
-import io
-import unittest
-
-from mock import patch
-
-from arm.starter import _load_settings
-
-
-class TestLoadSettings(unittest.TestCase):
-  def test_we_can_load_the_settings(self):
-config = _load_settings(self.id())
-self.assertEqual(config.get('settings_loaded'), 'true')
-
-  @patch('stem.util.conf.open', create = True)
-  def test_when_file_doesnt_exist(self, open_mock):
-open_mock.side_effect = IOError(No such file or directory)
-
-try:
-  _load_settings(self.id())
-  self.fail(We didn't raise an exception for a missing settings.cfg)
-except ValueError as exc:
-  self.assertTrue(Unable to load arm's internal configuration in 
str(exc))
-
-  @patch('stem.util.conf.open', create = True)
-  def test_that_repeated_calls_are_ignored(self, open_mock):
-open_mock.return_value = io.BytesIO(settings_loaded true)
-
-_load_settings(self.id())
-_load_settings(self.id())
-_load_settings(self.id())
-self.assertEqual(1, open_mock.call_count)
diff --git a/test/util/tracker/__init__.py b/test/util/tracker/__init__.py
new file mode 100644
index 000..e69de29
diff --git a/test/util/tracker/daemon.py b/test/util/tracker/daemon.py
new file mode 100644
index 000..9bde71f
--- /dev/null
+++ b/test/util/tracker/daemon.py
@@ -0,0 +1,47 @@
+import unittest
+
+from arm.util.tracker import Daemon
+
+from mock import patch
+
+
+class TestDaemon(unittest.TestCase):
+  @patch('arm.util.tracker.tor_controller')
+  @patch('arm.util.tracker.system')
+  def test_init(self, system_mock, tor_controller_mock):
+# Check that we register ourselves to listen for status changes, and
+# properly retrieve the process' pid and name.
+
+tor_controller_mock().get_pid.return_value = 12345
+system_mock.get_name_by_pid.return_value = 'local_tor'
+
+daemon = Daemon(0.05)
+
+self.assertEqual(0.05, daemon._rate)
+self.assertEqual(12345, daemon._process_pid)
+self.assertEqual('local_tor', daemon._process_name)
+
+
tor_controller_mock().add_status_listener.assert_called_with(daemon._tor_status_listener)
+system_mock.get_name_by_pid.assert_called_with(12345)
+
+  @patch('arm.util.tracker.tor_controller')
+  @patch('arm.util.tracker.system')
+  def test_init_without_name(self, system_mock, tor_controller_mock):
+# Check when we default to 'tor' if unable to determine the process' name.
+
+tor_controller_mock().get_pid.return_value = 12345
+system_mock.get_name_by_pid.return_value = None
+
+daemon = Daemon(0.05)
+self.assertEqual('tor', daemon._process_name)
+
+  @patch('arm.util.tracker.tor_controller')
+  @patch('arm.util.tracker.system')
+  def test_init_without_pid(self, system_mock, tor_controller_mock):
+# Check when we can't determine tor's pid.
+
+tor_controller_mock().get_pid.return_value = None
+
+

[tor-commits] [ooni-probe/master] Create a new class instance per test method

2014-01-05 Thread art
commit bff27aba551e64d429ef552fd0559ac859c5302c
Author: Arturo Filastò a...@fuffa.org
Date:   Mon Jan 6 00:21:36 2014 +0100

Create a new class instance per test method

* This makes sure the class attributes are not shared across test methods
---
 ooni/nettest.py |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ooni/nettest.py b/ooni/nettest.py
index 7e1ef04..a1a46d6 100644
--- a/ooni/nettest.py
+++ b/ooni/nettest.py
@@ -557,9 +557,9 @@ class NetTest(object):
 for test_class, test_methods in self.testCases:
 # load the input processor as late as possible
 for input in test_class.inputs:
-klass = test_class()
 measurements = []
 for method in test_methods:
+klass = test_class()
 log.debug(Running %s %s % (test_class, method))
 measurement = self.makeMeasurement(klass, method, input)
 measurements.append(measurement.done)



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


[tor-commits] [ooni-probe/master] Fix a bug inside of HTTP test template

2014-01-05 Thread art
commit 98bb2cf5b556d54fd68859928c7e5bc4882a205d
Author: Arturo Filastò a...@fuffa.org
Date:   Mon Jan 6 00:22:20 2014 +0100

Fix a bug inside of HTTP test template
---
 ooni/templates/httpt.py |6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/ooni/templates/httpt.py b/ooni/templates/httpt.py
index fdcbc3e..7c54782 100644
--- a/ooni/templates/httpt.py
+++ b/ooni/templates/httpt.py
@@ -232,13 +232,9 @@ class HTTPTest(NetTestCase):
 
 try:
 content_length = 
int(response.headers.getRawHeaders('content-length')[0])
-except IndexError:
+except Exception:
 content_length = None
 
-if not content_length:
-self._processResponseBody(None, request, response, None)
-return defer.succeed(None)
-
 finished = defer.Deferred()
 response.deliverBody(BodyReceiver(finished, content_length))
 finished.addCallback(self._processResponseBody, request,

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


[tor-commits] [ooni-probe/master] Refactor naming of nettest related code

2014-01-05 Thread art
commit cc9fbb70666cf5322956332415dcdbf8cd3592d1
Author: Arturo Filastò a...@fuffa.org
Date:   Mon Jan 6 00:44:44 2014 +0100

Refactor naming of nettest related code
---
 ooni/nettest.py |   12 ++--
 ooni/tasks.py   |4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/ooni/nettest.py b/ooni/nettest.py
index a1a46d6..513c11f 100644
--- a/ooni/nettest.py
+++ b/ooni/nettest.py
@@ -514,7 +514,7 @@ class NetTest(object):
 
 return report_results
 
-def makeMeasurement(self, test_class, test_method, test_input=None):
+def makeMeasurement(self, test_instance, test_method, test_input=None):
 
 Creates a new instance of :class:ooni.tasks.Measurement and add's it's
 callbacks and errbacks.
@@ -531,7 +531,7 @@ class NetTest(object):
 NetTestCase
 
 
-measurement = Measurement(test_class, test_method, test_input)
+measurement = Measurement(test_instance, test_method, test_input)
 measurement.netTest = self
 
 if self.director:
@@ -558,10 +558,10 @@ class NetTest(object):
 # load the input processor as late as possible
 for input in test_class.inputs:
 measurements = []
+test_instance = test_class()
 for method in test_methods:
-klass = test_class()
 log.debug(Running %s %s % (test_class, method))
-measurement = self.makeMeasurement(klass, method, input)
+measurement = self.makeMeasurement(test_instance, method, 
input)
 measurements.append(measurement.done)
 self.state.taskCreated()
 yield measurement
@@ -573,11 +573,11 @@ class NetTest(object):
 
 # Call the postProcessor, which must return a single report
 # or a deferred
-post.addCallback(klass.postProcessor)
+post.addCallback(test_instance.postProcessor)
 def noPostProcessor(failure, report):
 failure.trap(e.NoPostProcessor)
 return report
-post.addErrback(noPostProcessor, klass.report)
+post.addErrback(noPostProcessor, test_instance.report)
 post.addCallback(self.report.write)
 
 if self.report and self.director:
diff --git a/ooni/tasks.py b/ooni/tasks.py
index 9e74dd5..3e378e9 100644
--- a/ooni/tasks.py
+++ b/ooni/tasks.py
@@ -91,7 +91,7 @@ class TaskWithTimeout(BaseTask):
 return BaseTask.start(self)
 
 class Measurement(TaskWithTimeout):
-def __init__(self, test_class, test_method, test_input):
+def __init__(self, test_instance, test_method, test_input):
 
 test_class:
 is the class, subclass of NetTestCase, of the test to be run
@@ -106,7 +106,7 @@ class Measurement(TaskWithTimeout):
 net_test:
 a reference to the net_test object such measurement belongs to.
 
-self.testInstance = test_class
+self.testInstance = test_instance
 self.testInstance.input = test_input
 if 'input' not in self.testInstance.report.keys():
 self.testInstance.report = {'input': test_input}



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


[tor-commits] [ooni-probe/master] request_line_capitalization is a lie, remove it.

2014-01-05 Thread art
commit 9b89f699208cb19be726519bc79b4132c3fa44c1
Author: Arturo Filastò a...@fuffa.org
Date:   Mon Jan 6 00:45:38 2014 +0100

request_line_capitalization is a lie, remove it.
---
 ooni/nettests/manipulation/http_header_field_manipulation.py |9 -
 1 file changed, 9 deletions(-)

diff --git a/ooni/nettests/manipulation/http_header_field_manipulation.py 
b/ooni/nettests/manipulation/http_header_field_manipulation.py
index e059c42..3fdcc5f 100644
--- a/ooni/nettests/manipulation/http_header_field_manipulation.py
+++ b/ooni/nettests/manipulation/http_header_field_manipulation.py
@@ -100,9 +100,6 @@ class HTTPHeaderFieldManipulation(httpt.HTTPTest):
 *  **total** when the response is not a json object and therefore we 
were not
 able to reach the ooniprobe test backend
 
-*  **request_line_capitalization** when the HTTP Request line (e.x. 
GET /
-HTTP/1.1) does not match the capitalization we set.
-
 *  **header_field_number** when the number of headers we sent does not 
match
 with the ones the backend received
 
@@ -116,7 +113,6 @@ class HTTPHeaderFieldManipulation(httpt.HTTPTest):
 
 self.report['tampering'] = {
 'total': False,
-'request_line_capitalization': False,
 'header_name_capitalization': False,
 'header_field_value': False,
 'header_field_number': False
@@ -136,9 +132,6 @@ class HTTPHeaderFieldManipulation(httpt.HTTPTest):
 self.report['tampering']['total'] = True
 return
 
-if request_request_line != response_request_line:
-self.report['tampering']['request_line_capitalization'] = True
-
 request_headers = TrueHeaders(self.request_headers)
 diff = request_headers.getDiff(TrueHeaders(response_headers_dict),
 ignore=['Connection'])
@@ -148,7 +141,6 @@ class HTTPHeaderFieldManipulation(httpt.HTTPTest):
 self.report['tampering']['header_field_name'] = False
 self.report['tampering']['header_name_diff'] = list(diff)
 log.msg(total: %(total)s % self.report['tampering'])
-log.msg(request_line_capitalization: 
%(request_line_capitalization)s % self.report['tampering'])
 log.msg(header_name_capitalization: 
%(header_name_capitalization)s % self.report['tampering'])
 log.msg(header_field_value: %(header_field_value)s % 
self.report['tampering'])
 log.msg(header_field_number: %(header_field_number)s % 
self.report['tampering'])
@@ -188,4 +180,3 @@ class HTTPHeaderFieldManipulation(httpt.HTTPTest):
 self.request_headers = self.get_random_caps_headers()
 return self.doRequest(self.url, self.request_method,
 headers=self.request_headers)
-

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


[tor-commits] [ooni-probe/master] Case sensitivity is actually important.

2014-01-05 Thread art
commit 0fb6b6c020c9bd2739073e23dc0fddfe796fa38f
Author: Arturo Filastò a...@fuffa.org
Date:   Mon Jan 6 00:51:51 2014 +0100

Case sensitivity is actually important.
---
 data/ooniprobe.conf.sample |2 +-
 setup.py   |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/data/ooniprobe.conf.sample b/data/ooniprobe.conf.sample
index 8a4e0f7..412923a 100644
--- a/data/ooniprobe.conf.sample
+++ b/data/ooniprobe.conf.sample
@@ -21,7 +21,7 @@ reports:
 pcap: null
 collector: 'httpo://nkvphnp3p6agi5qq.onion'
 advanced:
-geoip_data_dir: /usr/share/geoip
+geoip_data_dir: /usr/share/GeoIP
 debug: false
 # enable if auto detection fails
 #tor_binary: /usr/sbin/tor
diff --git a/setup.py b/setup.py
index f761f30..bd9ebcf 100644
--- a/setup.py
+++ b/setup.py
@@ -68,7 +68,7 @@ if hasattr(sys, 'real_prefix'):
 )]
 else:
 data_files = [(
-'/usr/share/geoip/', 
+'/usr/share/GeoIP/', 
 [
 'data/GeoIP.dat',
 'data/GeoIPASNum.dat',

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


[tor-commits] [arm/master] Testing the ConnectionTracker class

2014-01-05 Thread atagar
commit 6f2ce6c6d1004fd69d8ba1038f08c1376cdf2625
Author: Damian Johnson ata...@torproject.org
Date:   Sun Jan 5 17:55:17 2014 -0800

Testing the ConnectionTracker class

Unit tests for our connection resolver daemon. There's a lot more tests we
could add for the tracker module, but this gets us pretty good coverage for
now.
---
 arm/util/tracker.py |2 +-
 test/util/tracker/connection_tracker.py |   76 +++
 test/util/tracker/resource_tracker.py   |5 +-
 3 files changed, 80 insertions(+), 3 deletions(-)

diff --git a/arm/util/tracker.py b/arm/util/tracker.py
index b0f99b2..6c5b1f4 100644
--- a/arm/util/tracker.py
+++ b/arm/util/tracker.py
@@ -384,7 +384,7 @@ class ConnectionTracker(Daemon):
 self._failure_count += 1
 
 if self._failure_count = 3:
-  self._resolvers.pop()
+  self._resolvers.pop(0)
   self._failure_count = 0
 
   if self._resolvers:
diff --git a/test/util/tracker/connection_tracker.py 
b/test/util/tracker/connection_tracker.py
new file mode 100644
index 000..bdb1d69
--- /dev/null
+++ b/test/util/tracker/connection_tracker.py
@@ -0,0 +1,76 @@
+import time
+import unittest
+
+from arm.util.tracker import ConnectionTracker
+
+from stem.util import connection
+
+from mock import Mock, patch
+
+CONNECTION_1 = connection.Connection('127.0.0.1', 3531, '75.119.206.243', 22, 
'tcp')
+CONNECTION_2 = connection.Connection('127.0.0.1', 1766, '86.59.30.40', 443, 
'tcp')
+CONNECTION_3 = connection.Connection('127.0.0.1', 1059, '74.125.28.106', 80, 
'tcp')
+
+
+class TestConnectionTracker(unittest.TestCase):
+  @patch('arm.util.tracker.tor_controller')
+  @patch('arm.util.tracker.connection.get_connections')
+  @patch('arm.util.tracker.system', Mock(return_value = Mock()))
+  @patch('arm.util.tracker.connection.get_system_resolvers', Mock(return_value 
= [connection.Resolver.NETSTAT]))
+  def test_fetching_connections(self, get_connections_mock, 
tor_controller_mock):
+tor_controller_mock().get_pid.return_value = 12345
+get_connections_mock.return_value = [CONNECTION_1, CONNECTION_2, 
CONNECTION_3]
+
+with ConnectionTracker(0.04) as daemon:
+  time.sleep(0.01)
+
+  connections = daemon.get_connections()
+
+  self.assertEqual(1, daemon.run_counter())
+  self.assertEqual([CONNECTION_1, CONNECTION_2, CONNECTION_3], connections)
+
+  get_connections_mock.return_value = []  # no connection results
+  time.sleep(0.05)
+  connections = daemon.get_connections()
+
+  self.assertEqual(2, daemon.run_counter())
+  self.assertEqual([], connections)
+
+  @patch('arm.util.tracker.tor_controller')
+  @patch('arm.util.tracker.connection.get_connections')
+  @patch('arm.util.tracker.system', Mock(return_value = Mock()))
+  @patch('arm.util.tracker.connection.get_system_resolvers', Mock(return_value 
= [connection.Resolver.NETSTAT, connection.Resolver.LSOF]))
+  def test_resolver_failover(self, get_connections_mock, tor_controller_mock):
+tor_controller_mock().get_pid.return_value = 12345
+get_connections_mock.side_effect = IOError()
+
+with ConnectionTracker(0.01) as daemon:
+  time.sleep(0.03)
+
+  self.assertEqual([connection.Resolver.NETSTAT, 
connection.Resolver.LSOF], daemon._resolvers)
+  self.assertEqual([], daemon.get_connections())
+
+  time.sleep(0.05)
+
+  self.assertEqual([connection.Resolver.LSOF], daemon._resolvers)
+  self.assertEqual([], daemon.get_connections())
+
+  time.sleep(0.05)
+
+  self.assertEqual([], daemon._resolvers)
+  self.assertEqual([], daemon.get_connections())
+
+  # Now make connection resolution work. We still shouldn't provide any
+  # results since we stopped looking.
+
+  get_connections_mock.return_value = [CONNECTION_1, CONNECTION_2]
+  get_connections_mock.side_effect = None
+  time.sleep(0.05)
+  self.assertEqual([], daemon.get_connections())
+
+  # Finally, select a custom resolver. This should cause us to query again
+  # reguardless of our prior failures.
+
+  daemon.set_custom_resolver(connection.Resolver.NETSTAT)
+  time.sleep(0.05)
+  self.assertEqual([CONNECTION_1, CONNECTION_2], daemon.get_connections())
diff --git a/test/util/tracker/resource_tracker.py 
b/test/util/tracker/resource_tracker.py
index 70cdf27..41ef80e 100644
--- a/test/util/tracker/resource_tracker.py
+++ b/test/util/tracker/resource_tracker.py
@@ -107,12 +107,13 @@ class TestResourceTracker(unittest.TestCase):
   self.assertEqual(0.0, resources.memory_percent)
   self.assertEqual(0.0, resources.timestamp)
 
-  time.sleep(0.05)
+  while daemon.run_counter()  1:
+time.sleep(0.01)
+
   self.assertEqual(False, daemon._use_proc)
 
   resources = daemon.get_resource_usage()
 
-  self.assertEqual(1, daemon.run_counter())
   self.assertEqual(0.0, resources.cpu_sample)
   self.assertEqual(43.875, 

[tor-commits] [arm/master] Test Daemon's general functionality

2014-01-05 Thread atagar
commit 2269d007c5ba9ba1207a49d1440e33284e57581d
Author: Damian Johnson ata...@torproject.org
Date:   Sun Jan 5 15:09:27 2014 -0800

Test Daemon's general functionality

Check that the Daemon's pause method and that it executes the given task at 
a
set rate.
---
 arm/util/tracker.py |   12 ++--
 test/util/tracker/daemon.py |   33 +++--
 2 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/arm/util/tracker.py b/arm/util/tracker.py
index 8febb12..1a716d3 100644
--- a/arm/util/tracker.py
+++ b/arm/util/tracker.py
@@ -218,7 +218,7 @@ class Daemon(threading.Thread):
   time_since_last_ran = time.time() - self._last_ran
 
   if self._is_paused or time_since_last_ran  self._rate:
-sleep_duration = max(0.2, self._rate - time_since_last_ran)
+sleep_duration = max(0.02, self._rate - time_since_last_ran)
 
 with self._pause_condition:
   if not self._halt:
@@ -248,7 +248,7 @@ class Daemon(threading.Thread):
 :returns: **bool** indicating if our run was successful or not
 
 
-pass
+return True
 
   def run_counter(self):
 
@@ -306,6 +306,14 @@ class Daemon(threading.Thread):
 self._process_pid = tor_pid
 self._process_name = tor_cmd if tor_cmd else 'tor'
 
+  def __enter__(self):
+self.start()
+return self
+
+  def __exit__(self, exit_type, value, traceback):
+self.stop()
+self.join()
+
 
 class ConnectionTracker(Daemon):
   
diff --git a/test/util/tracker/daemon.py b/test/util/tracker/daemon.py
index 9bde71f..9d409e2 100644
--- a/test/util/tracker/daemon.py
+++ b/test/util/tracker/daemon.py
@@ -1,8 +1,9 @@
+import time
 import unittest
 
 from arm.util.tracker import Daemon
 
-from mock import patch
+from mock import Mock, patch
 
 
 class TestDaemon(unittest.TestCase):
@@ -17,7 +18,7 @@ class TestDaemon(unittest.TestCase):
 
 daemon = Daemon(0.05)
 
-self.assertEqual(0.05, daemon._rate)
+self.assertEqual(0.05, daemon.get_rate())
 self.assertEqual(12345, daemon._process_pid)
 self.assertEqual('local_tor', daemon._process_name)
 
@@ -45,3 +46,31 @@ class TestDaemon(unittest.TestCase):
 daemon = Daemon(0.05)
 self.assertEqual(None, daemon._process_pid)
 self.assertEqual('tor', daemon._process_name)
+self.assertEqual(0, system_mock.call_count)
+
+  @patch('arm.util.tracker.tor_controller', Mock(return_value = Mock()))
+  @patch('arm.util.tracker.system', Mock(return_value = Mock()))
+  def test_daemon_calls_task(self):
+# Check that our Daemon calls the task method at the given rate.
+
+with Daemon(0.01) as daemon:
+  time.sleep(0.05)
+  self.assertTrue(2  daemon.run_counter())
+
+  @patch('arm.util.tracker.tor_controller', Mock(return_value = Mock()))
+  @patch('arm.util.tracker.system', Mock(return_value = Mock()))
+  def test_pausing_daemon(self):
+# Check that we can pause and unpause daemon.
+
+with Daemon(0.01) as daemon:
+  time.sleep(0.05)
+  self.assertTrue(2  daemon.run_counter())
+
+  daemon.set_paused(True)
+  daemon._run_counter = 0
+  time.sleep(0.05)
+  self.assertEqual(0, daemon.run_counter())
+
+  daemon.set_paused(False)
+  time.sleep(0.05)
+  self.assertTrue(2  daemon.run_counter())



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


[tor-commits] [arm/master] Testing the ResourceTracker class

2014-01-05 Thread atagar
commit 0cede13371c0796a5a819ef65466b9d2aaf0b806
Author: Damian Johnson ata...@torproject.org
Date:   Sun Jan 5 16:15:20 2014 -0800

Testing the ResourceTracker class

Unit tests for our daemon that tracks the resource usage of tor.
---
 arm/util/tracker.py   |   20 ++---
 test/util/tracker/resource_tracker.py |  142 +
 2 files changed, 152 insertions(+), 10 deletions(-)

diff --git a/arm/util/tracker.py b/arm/util/tracker.py
index 1a716d3..b0f99b2 100644
--- a/arm/util/tracker.py
+++ b/arm/util/tracker.py
@@ -31,7 +31,7 @@ Background tasks for gathering information about the tor 
process.
   :var float cpu_average: average cpu usage since we first started tracking 
the process
   :var float cpu_total: total cpu time the process has used since starting
   :var int memory_bytes: memory usage of the process in bytes
-  :var float memory_precent: percentage of our memory used by this process
+  :var float memory_percent: percentage of our memory used by this process
   :var float timestamp: unix timestamp for when this information was fetched
 
 
@@ -70,7 +70,7 @@ def get_connection_tracker():
   global CONNECTION_TRACKER
 
   if CONNECTION_TRACKER is None:
-CONNECTION_TRACKER = ConnectionTracker()
+CONNECTION_TRACKER = ConnectionTracker(CONFIG['queries.connections.rate'])
 
   return CONNECTION_TRACKER
 
@@ -83,7 +83,7 @@ def get_resource_tracker():
   global RESOURCE_TRACKER
 
   if RESOURCE_TRACKER is None:
-RESOURCE_TRACKER = ResourceTracker()
+RESOURCE_TRACKER = ResourceTracker(CONFIG['queries.resources.rate'])
 
   return RESOURCE_TRACKER
 
@@ -147,9 +147,9 @@ def _resources_via_ps(pid):
 total_cpu_time = str_tools.parse_short_time_label(stats[0])
 uptime = str_tools.parse_short_time_label(stats[1])
 memory_bytes = int(stats[2]) * 1024  # ps size is in kb
-memory_precent = float(stats[3]) / 100.0
+memory_percent = float(stats[3]) / 100.0
 
-return (total_cpu_time, uptime, memory_bytes, memory_precent)
+return (total_cpu_time, uptime, memory_bytes, memory_percent)
   except ValueError:
 pass
 
@@ -320,8 +320,8 @@ class ConnectionTracker(Daemon):
   Periodically retrieves the connections established by tor.
   
 
-  def __init__(self):
-super(ConnectionTracker, self).__init__(CONFIG['queries.connections.rate'])
+  def __init__(self, rate):
+super(ConnectionTracker, self).__init__(rate)
 
 self._connections = []
 self._resolvers = connection.get_system_resolvers()
@@ -437,8 +437,8 @@ class ResourceTracker(Daemon):
   Periodically retrieves the resource usage of tor.
   
 
-  def __init__(self):
-super(ResourceTracker, self).__init__(CONFIG['queries.resources.rate'])
+  def __init__(self, rate):
+super(ResourceTracker, self).__init__(rate)
 
 self._resources = None
 self._use_proc = proc.is_available()  # determines if we use proc or ps 
for lookups
@@ -469,7 +469,7 @@ class ResourceTracker(Daemon):
 cpu_average = total_cpu_time / uptime,
 cpu_total = total_cpu_time,
 memory_bytes = memory_in_bytes,
-memory_precent = memory_in_percent,
+memory_percent = memory_in_percent,
 timestamp = time.time(),
   )
 
diff --git a/test/util/tracker/resource_tracker.py 
b/test/util/tracker/resource_tracker.py
new file mode 100644
index 000..70cdf27
--- /dev/null
+++ b/test/util/tracker/resource_tracker.py
@@ -0,0 +1,142 @@
+import time
+import unittest
+
+from arm.util.tracker import ResourceTracker, _resources_via_ps, 
_resources_via_proc
+
+from mock import Mock, patch
+
+PS_OUTPUT = \
+TIME ELAPSED   RSS %MEM
+00:00:02   00:18 18848  0.4
+
+
+
+class TestResourceTracker(unittest.TestCase):
+  @patch('arm.util.tracker.tor_controller')
+  @patch('arm.util.tracker._resources_via_proc')
+  @patch('arm.util.tracker.system', Mock(return_value = Mock()))
+  @patch('arm.util.tracker.proc.is_available', Mock(return_value = True))
+  def test_fetching_samplings(self, resources_via_proc_mock, 
tor_controller_mock):
+tor_controller_mock().get_pid.return_value = 12345
+resources_via_proc_mock.return_value = (105.3, 2.4, 8072, 0.3)
+
+with ResourceTracker(0.04) as daemon:
+  time.sleep(0.01)
+
+  resources = daemon.get_resource_usage()
+
+  self.assertEqual(1, daemon.run_counter())
+  self.assertEqual(0.0, resources.cpu_sample)
+  self.assertEqual(43.875, resources.cpu_average)
+  self.assertEqual(105.3, resources.cpu_total)
+  self.assertEqual(8072, resources.memory_bytes)
+  self.assertEqual(0.3, resources.memory_percent)
+  self.assertTrue((time.time() - resources.timestamp)  0.5)
+
+  resources_via_proc_mock.return_value = (800.3, 3.2, 6020, 0.26)
+  time.sleep(0.05)
+  resources = daemon.get_resource_usage()
+
+  self.assertEqual(2, daemon.run_counter())
+  self.assertEqual(6.600189933523267, resources.cpu_sample)
+  

[tor-commits] [stem/master] Don't run static tests with the --test argument

2014-01-05 Thread atagar
commit 4cf84706db2416d11bc2ccd82a83a2397384cf0d
Author: Damian Johnson ata...@torproject.org
Date:   Sun Jan 5 21:39:00 2014 -0800

Don't run static tests with the --test argument

When we're running a single test it sucks to wait for static checks. They're
now quick, but not that quick.
---
 run_tests.py |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/run_tests.py b/run_tests.py
index 90493da..00cf381 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -153,7 +153,7 @@ def main():
 
   pyflakes_task, pep8_task = None, None
 
-  if not stem.prereq.is_python_3():
+  if not stem.prereq.is_python_3() and not args.test_prefix:
 if test.util.is_pyflakes_available():
   pyflakes_task = PYFLAKES_TASK
 



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


[tor-commits] [stem/master] Utility function to provide port usage information

2014-01-05 Thread atagar
commit 42bdd8307705ff33b762a60b2ba9d958650f4b59
Author: Damian Johnson ata...@torproject.org
Date:   Sun Jan 5 21:55:37 2014 -0800

Utility function to provide port usage information

Adding a stem.util.connection.port_usage() function that provides a brief
description of a port's common use. This is a capability arm has long hand, 
and
nicely complements our ability to query connection information.
---
 docs/change_log.rst  |1 +
 stem/util/connection.py  |   51 ++-
 stem/util/ports.cfg  |  312 ++
 test/unit/util/connection.py |   11 ++
 4 files changed, 374 insertions(+), 1 deletion(-)

diff --git a/docs/change_log.rst b/docs/change_log.rst
index 352d4a8..fa8b638 100644
--- a/docs/change_log.rst
+++ b/docs/change_log.rst
@@ -49,6 +49,7 @@ The following are only available within stem's `git repository
 
  * **Utilities**
 
+  * Added :func:`stem.util.connection.port_usage`
   * Added :func:`stem.util.system.files_with_suffix`
 
 .. _version_1.1:
diff --git a/stem/util/connection.py b/stem/util/connection.py
index 893230e..cd4fa70 100644
--- a/stem/util/connection.py
+++ b/stem/util/connection.py
@@ -8,6 +8,7 @@ Connection and networking based utility functions.
 
   get_connections - quieries the connections belonging to a given process
   get_system_resolvers - provides connection resolution methods that are 
likely to be available
+  port_usage - brief description of the common usage for a port
 
   is_valid_ipv4_address - checks if a string is a valid IPv4 address
   is_valid_ipv6_address - checks if a string is a valid IPv6 address
@@ -47,7 +48,7 @@ import re
 import stem.util.proc
 import stem.util.system
 
-from stem.util import enum, log
+from stem.util import conf, enum, log
 
 # Connection resolution is risky to log about since it's highly likely to
 # contain sensitive information. That said, it's also difficult to get right in
@@ -79,6 +80,8 @@ FULL_IPv6_MASK = :::::::
 
 CRYPTOVARIABLE_EQUALITY_COMPARISON_NONCE = os.urandom(32)
 
+PORT_USES = None  # port number = description
+
 RESOLVER_COMMAND = {
   Resolver.PROC: '',
 
@@ -269,6 +272,52 @@ def get_system_resolvers(system = None):
   return resolvers
 
 
+def port_usage(port):
+  
+  Provides the common use of a given port. For example, 'HTTP' for port 80 or
+  'SSH' for 22.
+
+  .. versionadded:: 1.2.0
+
+  :param int port: port number to look up
+
+  :returns: **str** with a description for the port, **None** if none is known
+  
+
+  global PORT_USES
+
+  if PORT_USES is None:
+config = conf.Config()
+config_path = os.path.join(os.path.dirname(__file__), 'ports.cfg')
+
+try:
+  config.load(config_path)
+  port_uses = {}
+
+  for key, value in config.get('port', {}).items():
+if key.isdigit():
+ port_uses[int(key)] = value
+elif '-' in key:
+  min_port, max_port = key.split('-', 1)
+
+  for port_entry in range(int(min_port), int(max_port) + 1):
+port_uses[port_entry] = value
+else:
+  raise ValueError('%s' is an invalid key % key)
+
+  PORT_USES = port_uses
+except Exception as exc:
+  log.warn(BUG: stem failed to load its internal port descriptions from 
'%s': %s % (config_path, exc))
+
+  if not PORT_USES:
+return None
+
+  if isinstance(port, str) and port.isdigit():
+port = int(port)
+
+  return PORT_USES.get(port)
+
+
 def is_valid_ipv4_address(address):
   
   Checks if a string is a valid IPv4 address.
diff --git a/stem/util/ports.cfg b/stem/util/ports.cfg
new file mode 100644
index 000..90c5e90
--- /dev/null
+++ b/stem/util/ports.cfg
@@ -0,0 +1,312 @@
+
+#
+# Common usages for port . This is based on...
+#
+#   https://secure.wikimedia.org/wikipedia/en/wiki/List_of_TCP_and_UDP_port 
numbers
+#   http://isc.sans.edu/services.html
+#
+
+
+port 1 = TCPMUX
+port 2 = CompressNET
+port 3 = CompressNET
+port 5 = RJE
+port 7 = Echo
+port 9 = Discard
+port 11 = SYSTAT
+port 13 = Daytime
+port 15 = netstat
+port 17 = QOTD
+port 18 = MSP
+port 19 = CHARGEN
+port 20 = FTP
+port 21 = FTP
+port 22 = SSH
+port 23 = Telnet
+port 24 = Priv-mail
+port 25 = SMTP
+port 34 = RF
+port 35 = Printer
+port 37 = TIME
+port 39 = RLP
+port 41 = Graphics
+port 42 = WINS
+port 43 = WHOIS
+port 47 = NI FTP
+port 49 = TACACS
+port 50 = Remote Mail
+port 51 = IMP
+port 52 = XNS
+port 53 = DNS
+port 54 = XNS
+port 55 = ISI-GL
+port 56 = RAP
+port 57 = MTP
+port 58 = XNS
+port 67 = BOOTP
+port 68 = BOOTP
+port 69 = TFTP
+port 70 = Gopher
+port 79 = Finger
+port 80 = HTTP
+port 81 = HTTP Alternate
+port 82 = Torpark
+port 83 = MIT ML
+port 88 = Kerberos
+port 90 = dnsix
+port 99 = WIP
+port 101 = NIC
+port 102 = ISO-TSAP
+port 104 = ACR/NEMA
+port 105 = CCSO
+port 107 = Telnet

[tor-commits] [stem/master] New succinct test output reported errors as successes

2014-01-05 Thread atagar
commit 6837752b4c5d7f74bef8be0bca8c8fc7f6f3e8f7
Author: Damian Johnson ata...@torproject.org
Date:   Sun Jan 5 21:50:40 2014 -0800

New succinct test output reported errors as successes

We reported failures as failures but didn't interpret errors as failures as
well.
---
 run_tests.py |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/run_tests.py b/run_tests.py
index 5450dea..f28ab8e 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -449,7 +449,7 @@ def _run_test(args, test_class, output_filters, 
logging_buffer):
   if args.verbose:
 sys.stdout.write(test.output.apply_filters(test_results.getvalue(), 
*output_filters))
 println()
-  elif not run_result.failures:
+  elif not run_result.failures and not run_result.errors:
 println( success (%0.2fs) % (time.time() - start_time), SUCCESS)
   else:
 println( failed (%0.2fs) % (time.time() - start_time), ERROR)



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


[tor-commits] [stem/master] Increase --test scope to be any module substring

2014-01-05 Thread atagar
commit b1081d4abb56439a7d4b8dfd254d079d32d9b976
Author: Damian Johnson ata...@torproject.org
Date:   Sun Jan 5 21:44:19 2014 -0800

Increase --test scope to be any module substring

Our --test argument only ran tests matching a given prefix but this was 
silly
for a couple reasons...

1. That's unintuitive. If I give 'util.conf' I expect it to run tests with
   'util.conf', not starting with that. There's no advantage to a prefix 
match.

2. Now that we're displaying less verbose test output we strip off the
   'test.unit.' or 'test.integ.' prefix that all the module names have. With
   this change the user can copy-and-paste what we show them to just run 
that
   test.
---
 run_tests.py  |   10 +-
 test/settings.cfg |2 +-
 test/util.py  |   16 
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/run_tests.py b/run_tests.py
index 00cf381..5450dea 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -45,7 +45,7 @@ ARGS = {
   'run_integ': False,
   'run_python3': False,
   'run_python3_clean': False,
-  'test_prefix': None,
+  'specific_test': None,
   'logging_runlevel': None,
   'tor_path': 'tor',
   'run_targets': [Target.RUN_OPEN],
@@ -153,7 +153,7 @@ def main():
 
   pyflakes_task, pep8_task = None, None
 
-  if not stem.prereq.is_python_3() and not args.test_prefix:
+  if not stem.prereq.is_python_3() and not args.specific_test:
 if test.util.is_pyflakes_available():
   pyflakes_task = PYFLAKES_TASK
 
@@ -212,7 +212,7 @@ def main():
 test.output.print_divider(UNIT TESTS, True)
 error_tracker.set_category(UNIT TEST)
 
-for test_class in test.util.get_unit_tests(args.test_prefix):
+for test_class in test.util.get_unit_tests(args.specific_test):
   run_result = _run_test(args, test_class, output_filters, logging_buffer)
   skipped_tests += len(getattr(run_result, 'skipped', []))
 
@@ -248,7 +248,7 @@ def main():
 if integ_runner.is_accessible():
   owner = integ_runner.get_tor_controller(True)  # controller to own 
our main Tor process
 
-for test_class in test.util.get_integ_tests(args.test_prefix):
+for test_class in test.util.get_integ_tests(args.specific_test):
   run_result = _run_test(args, test_class, output_filters, 
logging_buffer)
   skipped_tests += len(getattr(run_result, 'skipped', []))
 
@@ -379,7 +379,7 @@ def _get_args(argv):
   args['run_targets'] = run_targets
   args['attribute_targets'] = attribute_targets
 elif opt in (-l, --test):
-  args['test_prefix'] = arg
+  args['specific_test'] = arg
 elif opt in (-l, --log):
   arg = arg.upper()
 
diff --git a/test/settings.cfg b/test/settings.cfg
index e78ddb4..fd960a1 100644
--- a/test/settings.cfg
+++ b/test/settings.cfg
@@ -36,7 +36,7 @@ msg.help
 |  -u, --unitruns unit tests
 |  -i, --integ   runs integration tests
 |  -t, --target TARGET   comma separated list of extra targets for integ tests
-|  --test TEST_NAME  only run tests modules matching the given name prefix
+|  --test TEST_NAME  only run tests modules containing the given name
 |  --python3 runs tests against a 2to3 conversion of the codebase
 |  -l, --log RUNLEVELincludes logging output with test results, runlevels:
 |  TRACE, DEBUG, INFO, NOTICE, WARN, ERROR
diff --git a/test/util.py b/test/util.py
index cfa0b95..f4fb9fb 100644
--- a/test/util.py
+++ b/test/util.py
@@ -89,34 +89,34 @@ Target = stem.util.enum.UppercaseEnum(
 STEM_BASE = os.path.sep.join(__file__.split(os.path.sep)[:-2])
 
 
-def get_unit_tests(prefix = None):
+def get_unit_tests(module_substring = None):
   
   Provides the classes for our unit tests.
 
-  :param str prefix: only provide the test if the module starts with this 
prefix
+  :param str module_substring: only provide the test if the module includes 
this substring
 
   :returns: an **iterator** for our unit tests
   
 
-  return _get_tests(CONFIG[test.unit_tests].splitlines(), prefix)
+  return _get_tests(CONFIG[test.unit_tests].splitlines(), module_substring)
 
 
-def get_integ_tests(prefix = None):
+def get_integ_tests(module_substring = None):
   
   Provides the classes for our integration tests.
 
-  :param str prefix: only provide the test if the module starts with this 
prefix
+  :param str module_substring: only provide the test if the module includes 
this substring
 
   :returns: an **iterator** for our integration tests
   
 
-  return _get_tests(CONFIG[test.integ_tests].splitlines(), prefix)
+  return _get_tests(CONFIG[test.integ_tests].splitlines(), module_substring)
 
 
-def _get_tests(modules, prefix):
+def _get_tests(modules, module_substring):
   for import_name in modules:
 if import_name:
-  if prefix and not import_name.startswith(prefix):
+  if module_substring and module_substring not in import_name:
 continue
 
   # Dynamically imports