Author: Brian Kearns <[email protected]>
Branch: cleanup-tests
Changeset: r60789:4dc59684ba7b
Date: 2013-01-31 15:29 -0500
http://bitbucket.org/pypy/pypy/changeset/4dc59684ba7b/

Log:    move lib_pypy/pypy_test tests to test_lib_pypy

diff --git a/lib_pypy/pypy_test/__init__.py b/lib_pypy/pypy_test/__init__.py
deleted file mode 100644
--- a/lib_pypy/pypy_test/__init__.py
+++ /dev/null
@@ -1,1 +0,0 @@
-#
diff --git a/lib_pypy/pypy_test/test_collections.py 
b/lib_pypy/pypy_test/test_collections.py
deleted file mode 100644
--- a/lib_pypy/pypy_test/test_collections.py
+++ /dev/null
@@ -1,53 +0,0 @@
-from __future__ import absolute_import
-from lib_pypy import _collections as collections
-import py
-
-class TestDeque:
-    def test_remove_empty(self):
-        d = collections.deque([])
-        py.test.raises(ValueError, d.remove, 1)
-
-    def test_remove_mutating(self):
-        class MutatingCmp(object):
-            def __eq__(self, other):
-                d.clear()
-                return True
-
-        d = collections.deque([MutatingCmp()])
-        py.test.raises(IndexError, d.remove, 1)
-
-    def test_maxlen(self):
-        d = collections.deque([], 3)
-        d.append(1); d.append(2); d.append(3); d.append(4)
-        assert list(d) == [2, 3, 4]
-        assert repr(d) == "deque([2, 3, 4], maxlen=3)"
-
-        import pickle
-        d2 = pickle.loads(pickle.dumps(d))
-        assert repr(d2) == "deque([2, 3, 4], maxlen=3)"
-
-        import copy
-        d3 = copy.copy(d)
-        assert repr(d3) == "deque([2, 3, 4], maxlen=3)"
-
-    def test_count(self):
-        d = collections.deque([1, 2, 2, 3, 2])
-        assert d.count(2) == 3
-        assert d.count(4) == 0
-
-    def test_reverse(self):
-        d = collections.deque([1, 2, 2, 3, 2])
-        d.reverse()
-        assert list(d) == [2, 3, 2, 2, 1]
-
-        d = collections.deque(range(100))
-        d.reverse()
-        assert list(d) == range(99, -1, -1)
-
-    def test_subclass_with_kwargs(self):
-        class SubclassWithKwargs(collections.deque):
-            def __init__(self, newarg=1):
-                collections.deque.__init__(self)
-
-        # SF bug #1486663 -- this used to erroneously raise a TypeError
-        SubclassWithKwargs(newarg=1)
diff --git a/lib_pypy/pypy_test/test_datetime.py 
b/lib_pypy/pypy_test/test_datetime.py
deleted file mode 100644
--- a/lib_pypy/pypy_test/test_datetime.py
+++ /dev/null
@@ -1,59 +0,0 @@
-from __future__ import absolute_import
-import py
-
-from lib_pypy import datetime
-
-def test_repr():
-    print datetime
-    expected = "datetime.datetime(1, 2, 3, 0, 0)"
-    assert repr(datetime.datetime(1,2,3)) == expected
-
-def test_strptime():
-    import time, sys
-    if sys.version_info < (2, 6):
-        py.test.skip("needs the _strptime module")
-
-    string = '2004-12-01 13:02:47'
-    format = '%Y-%m-%d %H:%M:%S'
-    expected = datetime.datetime(*(time.strptime(string, format)[0:6]))
-    got = datetime.datetime.strptime(string, format)
-    assert expected == got
-
-def test_datetime_rounding():
-    b = 0.0000001
-    a = 0.9999994
-
-    assert datetime.datetime.utcfromtimestamp(a).microsecond == 999999
-    assert datetime.datetime.utcfromtimestamp(a).second == 0
-    a += b
-    assert datetime.datetime.utcfromtimestamp(a).microsecond == 999999
-    assert datetime.datetime.utcfromtimestamp(a).second == 0
-    a += b
-    assert datetime.datetime.utcfromtimestamp(a).microsecond == 0
-    assert datetime.datetime.utcfromtimestamp(a).second == 1
-
-def test_more_datetime_rounding():
-    # this test verified on top of CPython 2.7 (using a plain
-    # "import datetime" above)
-    expected_results = {
-        -1000.0: 'datetime.datetime(1970, 1, 1, 0, 43, 20)',
-        -999.9999996: 'datetime.datetime(1970, 1, 1, 0, 43, 20)',
-        -999.4: 'datetime.datetime(1970, 1, 1, 0, 43, 20, 600000)',
-        -999.0000004: 'datetime.datetime(1970, 1, 1, 0, 43, 21)',
-        -1.0: 'datetime.datetime(1970, 1, 1, 0, 59, 59)',
-        -0.9999996: 'datetime.datetime(1970, 1, 1, 0, 59, 59)',
-        -0.4: 'datetime.datetime(1970, 1, 1, 0, 59, 59, 600000)',
-        -0.0000004: 'datetime.datetime(1970, 1, 1, 1, 0)',
-        0.0: 'datetime.datetime(1970, 1, 1, 1, 0)',
-        0.0000004: 'datetime.datetime(1970, 1, 1, 1, 0)',
-        0.4: 'datetime.datetime(1970, 1, 1, 1, 0, 0, 400000)',
-        0.9999996: 'datetime.datetime(1970, 1, 1, 1, 0, 1)',
-        1000.0: 'datetime.datetime(1970, 1, 1, 1, 16, 40)',
-        1000.0000004: 'datetime.datetime(1970, 1, 1, 1, 16, 40)',
-        1000.4: 'datetime.datetime(1970, 1, 1, 1, 16, 40, 400000)',
-        1000.9999996: 'datetime.datetime(1970, 1, 1, 1, 16, 41)',
-        1293843661.191: 'datetime.datetime(2011, 1, 1, 2, 1, 1, 191000)',
-        }
-    for t in sorted(expected_results):
-        dt = datetime.datetime.fromtimestamp(t)
-        assert repr(dt) == expected_results[t]
diff --git a/lib_pypy/pypy_test/hack___pypy__.py 
b/pypy/module/test_lib_pypy/hack___pypy__.py
rename from lib_pypy/pypy_test/hack___pypy__.py
rename to pypy/module/test_lib_pypy/hack___pypy__.py
diff --git a/lib_pypy/pypy_test/inprogress_test_binascii_extra.py 
b/pypy/module/test_lib_pypy/inprogress_test_binascii_extra.py
rename from lib_pypy/pypy_test/inprogress_test_binascii_extra.py
rename to pypy/module/test_lib_pypy/inprogress_test_binascii_extra.py
diff --git a/lib_pypy/pypy_test/no_test_pickle_extra.py 
b/pypy/module/test_lib_pypy/no_test_pickle_extra.py
rename from lib_pypy/pypy_test/no_test_pickle_extra.py
rename to pypy/module/test_lib_pypy/no_test_pickle_extra.py
diff --git a/pypy/module/test_lib_pypy/test_collections.py 
b/pypy/module/test_lib_pypy/test_collections.py
--- a/pypy/module/test_lib_pypy/test_collections.py
+++ b/pypy/module/test_lib_pypy/test_collections.py
@@ -1,25 +1,53 @@
+from __future__ import absolute_import
+from lib_pypy import _collections as collections
+import py
 
-"""
-Extra tests for the pure Python PyPy _collections module
-(not used in normal PyPy's)
-"""
+class TestDeque:
+    def test_remove_empty(self):
+        d = collections.deque([])
+        py.test.raises(ValueError, d.remove, 1)
 
-class AppTestCollections:
-    def test_copy(self):
-        import _collections
-        def f():
-            return 42
-        d = _collections.defaultdict(f, {2: 3})
-        #
-        d1 = d.copy()
-        assert type(d1) is _collections.defaultdict
-        assert len(d1) == 1
-        assert d1[2] == 3
-        assert d1[3] == 42
-        #
+    def test_remove_mutating(self):
+        class MutatingCmp(object):
+            def __eq__(self, other):
+                d.clear()
+                return True
+
+        d = collections.deque([MutatingCmp()])
+        py.test.raises(IndexError, d.remove, 1)
+
+    def test_maxlen(self):
+        d = collections.deque([], 3)
+        d.append(1); d.append(2); d.append(3); d.append(4)
+        assert list(d) == [2, 3, 4]
+        assert repr(d) == "deque([2, 3, 4], maxlen=3)"
+
+        import pickle
+        d2 = pickle.loads(pickle.dumps(d))
+        assert repr(d2) == "deque([2, 3, 4], maxlen=3)"
+
         import copy
-        d2 = copy.deepcopy(d)
-        assert type(d2) is _collections.defaultdict
-        assert len(d2) == 1
-        assert d2[2] == 3
-        assert d2[3] == 42
+        d3 = copy.copy(d)
+        assert repr(d3) == "deque([2, 3, 4], maxlen=3)"
+
+    def test_count(self):
+        d = collections.deque([1, 2, 2, 3, 2])
+        assert d.count(2) == 3
+        assert d.count(4) == 0
+
+    def test_reverse(self):
+        d = collections.deque([1, 2, 2, 3, 2])
+        d.reverse()
+        assert list(d) == [2, 3, 2, 2, 1]
+
+        d = collections.deque(range(100))
+        d.reverse()
+        assert list(d) == range(99, -1, -1)
+
+    def test_subclass_with_kwargs(self):
+        class SubclassWithKwargs(collections.deque):
+            def __init__(self, newarg=1):
+                collections.deque.__init__(self)
+
+        # SF bug #1486663 -- this used to erroneously raise a TypeError
+        SubclassWithKwargs(newarg=1)
diff --git a/pypy/module/test_lib_pypy/test_collections.py 
b/pypy/module/test_lib_pypy/test_collections_extra.py
copy from pypy/module/test_lib_pypy/test_collections.py
copy to pypy/module/test_lib_pypy/test_collections_extra.py
diff --git a/lib_pypy/pypy_test/test_coroutine.py 
b/pypy/module/test_lib_pypy/test_coroutine.py
rename from lib_pypy/pypy_test/test_coroutine.py
rename to pypy/module/test_lib_pypy/test_coroutine.py
diff --git a/pypy/module/test_lib_pypy/test_datetime.py 
b/pypy/module/test_lib_pypy/test_datetime.py
--- a/pypy/module/test_lib_pypy/test_datetime.py
+++ b/pypy/module/test_lib_pypy/test_datetime.py
@@ -1,52 +1,59 @@
-"""Additional tests for datetime."""
-
+from __future__ import absolute_import
 import py
 
-import time
 from lib_pypy import datetime
-import copy
-import os
 
-def test_utcfromtimestamp():
-    """Confirm that utcfromtimestamp and fromtimestamp give consistent results.
+def test_repr():
+    print datetime
+    expected = "datetime.datetime(1, 2, 3, 0, 0)"
+    assert repr(datetime.datetime(1,2,3)) == expected
 
-    Based on danchr's test script in https://bugs.pypy.org/issue986
-    """
-    try:
-        prev_tz = os.environ.get("TZ")
-        os.environ["TZ"] = "GMT"
-        for unused in xrange(100):
-            now = time.time()
-            delta = (datetime.datetime.utcfromtimestamp(now) -
-                     datetime.datetime.fromtimestamp(now))
-            assert delta.days * 86400 + delta.seconds == 0
-    finally:
-        if prev_tz is None:
-            del os.environ["TZ"]
-        else:
-            os.environ["TZ"] = prev_tz
+def test_strptime():
+    import time, sys
+    if sys.version_info < (2, 6):
+        py.test.skip("needs the _strptime module")
 
-def test_utcfromtimestamp_microsecond():
-    dt = datetime.datetime.utcfromtimestamp(0)
-    assert isinstance(dt.microsecond, int)
+    string = '2004-12-01 13:02:47'
+    format = '%Y-%m-%d %H:%M:%S'
+    expected = datetime.datetime(*(time.strptime(string, format)[0:6]))
+    got = datetime.datetime.strptime(string, format)
+    assert expected == got
 
+def test_datetime_rounding():
+    b = 0.0000001
+    a = 0.9999994
 
-def test_integer_args():
-    with py.test.raises(TypeError):
-        datetime.datetime(10, 10, 10.)
-    with py.test.raises(TypeError):
-        datetime.datetime(10, 10, 10, 10, 10.)
-    with py.test.raises(TypeError):
-        datetime.datetime(10, 10, 10, 10, 10, 10.)
+    assert datetime.datetime.utcfromtimestamp(a).microsecond == 999999
+    assert datetime.datetime.utcfromtimestamp(a).second == 0
+    a += b
+    assert datetime.datetime.utcfromtimestamp(a).microsecond == 999999
+    assert datetime.datetime.utcfromtimestamp(a).second == 0
+    a += b
+    assert datetime.datetime.utcfromtimestamp(a).microsecond == 0
+    assert datetime.datetime.utcfromtimestamp(a).second == 1
 
-def test_utcnow_microsecond():
-    dt = datetime.datetime.utcnow()
-    assert type(dt.microsecond) is int
-
-    copy.copy(dt)
-
-def test_radd():
-    class X(object):
-        def __radd__(self, other):
-            return "radd"
-    assert datetime.date(10, 10, 10) + X() == "radd"
+def test_more_datetime_rounding():
+    # this test verified on top of CPython 2.7 (using a plain
+    # "import datetime" above)
+    expected_results = {
+        -1000.0: 'datetime.datetime(1970, 1, 1, 0, 43, 20)',
+        -999.9999996: 'datetime.datetime(1970, 1, 1, 0, 43, 20)',
+        -999.4: 'datetime.datetime(1970, 1, 1, 0, 43, 20, 600000)',
+        -999.0000004: 'datetime.datetime(1970, 1, 1, 0, 43, 21)',
+        -1.0: 'datetime.datetime(1970, 1, 1, 0, 59, 59)',
+        -0.9999996: 'datetime.datetime(1970, 1, 1, 0, 59, 59)',
+        -0.4: 'datetime.datetime(1970, 1, 1, 0, 59, 59, 600000)',
+        -0.0000004: 'datetime.datetime(1970, 1, 1, 1, 0)',
+        0.0: 'datetime.datetime(1970, 1, 1, 1, 0)',
+        0.0000004: 'datetime.datetime(1970, 1, 1, 1, 0)',
+        0.4: 'datetime.datetime(1970, 1, 1, 1, 0, 0, 400000)',
+        0.9999996: 'datetime.datetime(1970, 1, 1, 1, 0, 1)',
+        1000.0: 'datetime.datetime(1970, 1, 1, 1, 16, 40)',
+        1000.0000004: 'datetime.datetime(1970, 1, 1, 1, 16, 40)',
+        1000.4: 'datetime.datetime(1970, 1, 1, 1, 16, 40, 400000)',
+        1000.9999996: 'datetime.datetime(1970, 1, 1, 1, 16, 41)',
+        1293843661.191: 'datetime.datetime(2011, 1, 1, 2, 1, 1, 191000)',
+        }
+    for t in sorted(expected_results):
+        dt = datetime.datetime.fromtimestamp(t)
+        assert repr(dt) == expected_results[t]
diff --git a/pypy/module/test_lib_pypy/test_datetime.py 
b/pypy/module/test_lib_pypy/test_datetime_extra.py
copy from pypy/module/test_lib_pypy/test_datetime.py
copy to pypy/module/test_lib_pypy/test_datetime_extra.py
diff --git a/lib_pypy/pypy_test/test_dbm_extra.py 
b/pypy/module/test_lib_pypy/test_dbm_extra.py
rename from lib_pypy/pypy_test/test_dbm_extra.py
rename to pypy/module/test_lib_pypy/test_dbm_extra.py
diff --git a/lib_pypy/pypy_test/test_defaultdict.py 
b/pypy/module/test_lib_pypy/test_defaultdict.py
rename from lib_pypy/pypy_test/test_defaultdict.py
rename to pypy/module/test_lib_pypy/test_defaultdict.py
diff --git a/lib_pypy/pypy_test/test_deque_extra.py 
b/pypy/module/test_lib_pypy/test_deque_extra.py
rename from lib_pypy/pypy_test/test_deque_extra.py
rename to pypy/module/test_lib_pypy/test_deque_extra.py
diff --git a/lib_pypy/pypy_test/test_exception_extra.py 
b/pypy/module/test_lib_pypy/test_exception_extra.py
rename from lib_pypy/pypy_test/test_exception_extra.py
rename to pypy/module/test_lib_pypy/test_exception_extra.py
diff --git a/lib_pypy/pypy_test/test_grp_extra.py 
b/pypy/module/test_lib_pypy/test_grp_extra.py
rename from lib_pypy/pypy_test/test_grp_extra.py
rename to pypy/module/test_lib_pypy/test_grp_extra.py
diff --git a/lib_pypy/pypy_test/test_marshal_extra.py 
b/pypy/module/test_lib_pypy/test_marshal_extra.py
rename from lib_pypy/pypy_test/test_marshal_extra.py
rename to pypy/module/test_lib_pypy/test_marshal_extra.py
diff --git a/lib_pypy/pypy_test/test_md5_extra.py 
b/pypy/module/test_lib_pypy/test_md5_extra.py
rename from lib_pypy/pypy_test/test_md5_extra.py
rename to pypy/module/test_lib_pypy/test_md5_extra.py
diff --git a/lib_pypy/pypy_test/test_os_wait.py 
b/pypy/module/test_lib_pypy/test_os_wait.py
rename from lib_pypy/pypy_test/test_os_wait.py
rename to pypy/module/test_lib_pypy/test_os_wait.py
diff --git a/lib_pypy/pypy_test/test_pickle_extra.py 
b/pypy/module/test_lib_pypy/test_pickle_extra.py
rename from lib_pypy/pypy_test/test_pickle_extra.py
rename to pypy/module/test_lib_pypy/test_pickle_extra.py
diff --git a/lib_pypy/pypy_test/test_resource.py 
b/pypy/module/test_lib_pypy/test_resource.py
rename from lib_pypy/pypy_test/test_resource.py
rename to pypy/module/test_lib_pypy/test_resource.py
diff --git a/lib_pypy/pypy_test/test_sha_extra.py 
b/pypy/module/test_lib_pypy/test_sha_extra.py
rename from lib_pypy/pypy_test/test_sha_extra.py
rename to pypy/module/test_lib_pypy/test_sha_extra.py
diff --git a/lib_pypy/pypy_test/test_site_extra.py 
b/pypy/module/test_lib_pypy/test_site_extra.py
rename from lib_pypy/pypy_test/test_site_extra.py
rename to pypy/module/test_lib_pypy/test_site_extra.py
diff --git a/lib_pypy/pypy_test/test_stackless.py 
b/pypy/module/test_lib_pypy/test_stackless.py
rename from lib_pypy/pypy_test/test_stackless.py
rename to pypy/module/test_lib_pypy/test_stackless.py
diff --git a/lib_pypy/pypy_test/test_stackless_pickling.py 
b/pypy/module/test_lib_pypy/test_stackless_pickling.py
rename from lib_pypy/pypy_test/test_stackless_pickling.py
rename to pypy/module/test_lib_pypy/test_stackless_pickling.py
diff --git a/lib_pypy/pypy_test/test_structseq.py 
b/pypy/module/test_lib_pypy/test_structseq.py
rename from lib_pypy/pypy_test/test_structseq.py
rename to pypy/module/test_lib_pypy/test_structseq.py
diff --git a/lib_pypy/pypy_test/test_syslog.py 
b/pypy/module/test_lib_pypy/test_syslog.py
rename from lib_pypy/pypy_test/test_syslog.py
rename to pypy/module/test_lib_pypy/test_syslog.py
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to