You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by ad...@apache.org on 2014/06/16 08:16:03 UTC

svn commit: r1602804 [3/3] - in /labs/panopticon: ./ bin/ docs/ docs/source/ docs/source/reference/api/ docs/source/reference/commands/ pan-commands/ pan-commands/bin/ pan-commands/docs/ pan-commands/docs/source/ pan-commands/docs/source/reference/ pan...

Copied: labs/panopticon/pan-utils/tests/test_podlings.py (from r1594458, labs/panopticon/tests/test_podlings.py)
URL: http://svn.apache.org/viewvc/labs/panopticon/pan-utils/tests/test_podlings.py?p2=labs/panopticon/pan-utils/tests/test_podlings.py&p1=labs/panopticon/tests/test_podlings.py&r1=1594458&r2=1602804&rev=1602804&view=diff
==============================================================================
--- labs/panopticon/tests/test_podlings.py (original)
+++ labs/panopticon/pan-utils/tests/test_podlings.py Mon Jun 16 06:15:59 2014
@@ -19,17 +19,14 @@
 import os
 import datetime
 
-from nose.plugins.attrib import attr
-
 from asf.incubator.podlings import Podling, retired, graduated, incubating, VALID_STATUS
 from asf.utils.committers import get_committer
-from asf.utils.test import ensure_credentials_stored
+from asf.utils.test import ensure_credentials_stored, username, password
 
 
 DATA_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'data')
 
 
-@attr('integration')
 @ensure_credentials_stored
 def test_from_xml(username, password):
     with open(os.path.join(DATA_ROOT, 'podlings.xml'), 'r') as fh:

Copied: labs/panopticon/pan-utils/tests/test_projects.py (from r1594458, labs/panopticon/tests/test_projects.py)
URL: http://svn.apache.org/viewvc/labs/panopticon/pan-utils/tests/test_projects.py?p2=labs/panopticon/pan-utils/tests/test_projects.py&p1=labs/panopticon/tests/test_projects.py&r1=1594458&r2=1602804&rev=1602804&view=diff
==============================================================================
--- labs/panopticon/tests/test_projects.py (original)
+++ labs/panopticon/pan-utils/tests/test_projects.py Mon Jun 16 06:15:59 2014
@@ -20,7 +20,7 @@ from asf.data.projects import get_pmcs
 
 
 def test_get_pmcs():
-    pmcs =  get_pmcs()
+    pmcs = get_pmcs()
 
     assert pmcs
     assert 'geronimo' in pmcs

Copied: labs/panopticon/pan-utils/tests/test_safe.py (from r1594458, labs/panopticon/tests/test_safe.py)
URL: http://svn.apache.org/viewvc/labs/panopticon/pan-utils/tests/test_safe.py?p2=labs/panopticon/pan-utils/tests/test_safe.py&p1=labs/panopticon/tests/test_safe.py&r1=1594458&r2=1602804&rev=1602804&view=diff
==============================================================================
--- labs/panopticon/tests/test_safe.py (original)
+++ labs/panopticon/pan-utils/tests/test_safe.py Mon Jun 16 06:15:59 2014
@@ -18,7 +18,7 @@
 #
 from time import sleep
 
-from nose.tools import assert_equals, assert_raises
+import pytest
 
 from asf.utils.safe import DefaultStore, DefaultCodec, default_key_generator, Safe
 
@@ -28,21 +28,18 @@ def test_default_store():
 
     store.set('foo', 'bar')
 
-    assert_equals('bar', store.get('foo'))
+    assert 'bar' == store.get('foo')
 
 
-def test_default_store():
+def test_default_store_lifetime():
     store = DefaultStore(lifetime=1, period=1)
 
     store.set('foo', 'bar')
 
     sleep(3)
 
-    try:
+    with pytest.raises(KeyError):
         store.get('foo')
-        assert False, 'KeyError should have been thrown for expired entry'
-    except KeyError:
-        pass
 
 
 def test_default_codec():
@@ -51,7 +48,7 @@ def test_default_codec():
     key = default_key_generator()
     data = 'How now brown cow!'
 
-    assert_equals(data, codec.decrypt(codec.encrypt('How now brown cow!', key), key))
+    assert data == codec.decrypt(codec.encrypt('How now brown cow!', key), key)
 
 
 def test_safe():
@@ -60,10 +57,8 @@ def test_safe():
 
     encryption_key = safe.set('foo', data)
 
-    assert_equals(data, safe.get('foo', encryption_key))
+    assert data == safe.get('foo', encryption_key)
 
-    try:
+    # ValueError should have be thrown for invalid encryption_key
+    with pytest.raises(ValueError):
         safe.get('foo', default_key_generator())
-        assert False, 'ValueError should have been thrown for invalid encryption_key'
-    except ValueError:
-        pass

Added: labs/panopticon/pan-utils/tox.ini
URL: http://svn.apache.org/viewvc/labs/panopticon/pan-utils/tox.ini?rev=1602804&view=auto
==============================================================================
--- labs/panopticon/pan-utils/tox.ini (added)
+++ labs/panopticon/pan-utils/tox.ini Mon Jun 16 06:15:59 2014
@@ -0,0 +1,13 @@
+[tox]
+deps=-rrequirements.txt
+envlist=flake8,pytest
+
+[testenv:pytest]
+deps=pytest
+     mock
+     -rrequirements.txt
+commands=py.test {posargs} # substitute with tox' positional arguments
+
+[testenv:flake8]
+commands = flake8 {posargs}
+deps = flake8



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org