aboutsummaryrefslogtreecommitdiffstats
path: root/community/py3-twisted/remove-locale-dependent-tests.patch
blob: 5fcf91224b92b9b47f695d49f7966ae13ae2d5b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
diff --git a/src/twisted/conch/test/test_cftp.py b/src/twisted/conch/test/test_cftp.py
index 58eb5cc..62e8a8b 100644
--- a/src/twisted/conch/test/test_cftp.py
+++ b/src/twisted/conch/test/test_cftp.py
@@ -64,158 +64,6 @@ class SSHSessionTests(TestCase):
 
 
 
-class ListingTests(TestCase):
-    """
-    Tests for L{lsLine}, the function which generates an entry for a file or
-    directory in an SFTP I{ls} command's output.
-    """
-    if getattr(time, 'tzset', None) is None:
-        skip = "Cannot test timestamp formatting code without time.tzset"
-
-
-    def setUp(self):
-        """
-        Patch the L{ls} module's time function so the results of L{lsLine} are
-        deterministic.
-        """
-        self.now = 123456789
-        def fakeTime():
-            return self.now
-        self.patch(ls, 'time', fakeTime)
-
-        # Make sure that the timezone ends up the same after these tests as
-        # it was before.
-        if 'TZ' in os.environ:
-            self.addCleanup(operator.setitem, os.environ, 'TZ', os.environ['TZ'])
-            self.addCleanup(time.tzset)
-        else:
-            def cleanup():
-                # os.environ.pop is broken!  Don't use it!  Ever!  Or die!
-                try:
-                    del os.environ['TZ']
-                except KeyError:
-                    pass
-                time.tzset()
-            self.addCleanup(cleanup)
-
-
-    def _lsInTimezone(self, timezone, stat):
-        """
-        Call L{ls.lsLine} after setting the timezone to C{timezone} and return
-        the result.
-        """
-        # Set the timezone to a well-known value so the timestamps are
-        # predictable.
-        os.environ['TZ'] = timezone
-        time.tzset()
-        return ls.lsLine('foo', stat)
-
-
-    def test_oldFile(self):
-        """
-        A file with an mtime six months (approximately) or more in the past has
-        a listing including a low-resolution timestamp.
-        """
-        # Go with 7 months.  That's more than 6 months.
-        then = self.now - (60 * 60 * 24 * 31 * 7)
-        stat = os.stat_result((0, 0, 0, 0, 0, 0, 0, 0, then, 0))
-
-        self.assertEqual(
-            self._lsInTimezone('America/New_York', stat),
-            '!---------    0 0        0               0 Apr 26  1973 foo')
-        self.assertEqual(
-            self._lsInTimezone('Pacific/Auckland', stat),
-            '!---------    0 0        0               0 Apr 27  1973 foo')
-
-
-    def test_oldSingleDigitDayOfMonth(self):
-        """
-        A file with a high-resolution timestamp which falls on a day of the
-        month which can be represented by one decimal digit is formatted with
-        one padding 0 to preserve the columns which come after it.
-        """
-        # A point about 7 months in the past, tweaked to fall on the first of a
-        # month so we test the case we want to test.
-        then = self.now - (60 * 60 * 24 * 31 * 7) + (60 * 60 * 24 * 5)
-        stat = os.stat_result((0, 0, 0, 0, 0, 0, 0, 0, then, 0))
-
-        self.assertEqual(
-            self._lsInTimezone('America/New_York', stat),
-            '!---------    0 0        0               0 May 01  1973 foo')
-        self.assertEqual(
-            self._lsInTimezone('Pacific/Auckland', stat),
-            '!---------    0 0        0               0 May 02  1973 foo')
-
-
-    def test_newFile(self):
-        """
-        A file with an mtime fewer than six months (approximately) in the past
-        has a listing including a high-resolution timestamp excluding the year.
-        """
-        # A point about three months in the past.
-        then = self.now - (60 * 60 * 24 * 31 * 3)
-        stat = os.stat_result((0, 0, 0, 0, 0, 0, 0, 0, then, 0))
-
-        self.assertEqual(
-            self._lsInTimezone('America/New_York', stat),
-            '!---------    0 0        0               0 Aug 28 17:33 foo')
-        self.assertEqual(
-            self._lsInTimezone('Pacific/Auckland', stat),
-            '!---------    0 0        0               0 Aug 29 09:33 foo')
-
-
-    def test_localeIndependent(self):
-        """
-        The month name in the date is locale independent.
-        """
-        # A point about three months in the past.
-        then = self.now - (60 * 60 * 24 * 31 * 3)
-        stat = os.stat_result((0, 0, 0, 0, 0, 0, 0, 0, then, 0))
-
-        # Fake that we're in a language where August is not Aug (e.g.: Spanish)
-        currentLocale = locale.getlocale()
-        locale.setlocale(locale.LC_ALL, "es_AR.UTF8")
-        self.addCleanup(locale.setlocale, locale.LC_ALL, currentLocale)
-
-        self.assertEqual(
-            self._lsInTimezone('America/New_York', stat),
-            '!---------    0 0        0               0 Aug 28 17:33 foo')
-        self.assertEqual(
-            self._lsInTimezone('Pacific/Auckland', stat),
-            '!---------    0 0        0               0 Aug 29 09:33 foo')
-
-    # If alternate locale is not available, the previous test will be
-    # skipped, please install this locale for it to run
-    currentLocale = locale.getlocale()
-    try:
-        try:
-            locale.setlocale(locale.LC_ALL, "es_AR.UTF8")
-        except locale.Error:
-            test_localeIndependent.skip = "The es_AR.UTF8 locale is not installed."
-    finally:
-        locale.setlocale(locale.LC_ALL, currentLocale)
-
-
-    def test_newSingleDigitDayOfMonth(self):
-        """
-        A file with a high-resolution timestamp which falls on a day of the
-        month which can be represented by one decimal digit is formatted with
-        one padding 0 to preserve the columns which come after it.
-        """
-        # A point about three months in the past, tweaked to fall on the first
-        # of a month so we test the case we want to test.
-        then = self.now - (60 * 60 * 24 * 31 * 3) + (60 * 60 * 24 * 4)
-        stat = os.stat_result((0, 0, 0, 0, 0, 0, 0, 0, then, 0))
-
-        self.assertEqual(
-            self._lsInTimezone('America/New_York', stat),
-            '!---------    0 0        0               0 Sep 01 17:33 foo')
-        self.assertEqual(
-            self._lsInTimezone('Pacific/Auckland', stat),
-            '!---------    0 0        0               0 Sep 02 09:33 foo')
-
-
-
 class InMemorySSHChannel(StringTransport, object):
     """
     Minimal implementation of a L{SSHChannel} like class which only reads and