david-sarah
a79ec1c6cd
test_util.py: use SHA-256 from pycryptopp instead of MD5 from hashlib (for uses in which any hash will do), since hashlib was only added to the stdlib in Python 2.5.
2010-08-05 22:00:51 -07:00
david-sarah
8e90255349
test_util.py: remove use of 'a if p else b' syntax that requires Python 2.5.
2010-08-05 21:16:16 -07:00
Brian Warner
43c5032105
util/spans.py: __nonzero__ cannot return a long either. for #1154
2010-08-05 11:55:07 -07:00
Brian Warner
8844655705
One fix for bug #1154 : webapi GETs with a 'Range' header broke new-downloader.
...
The Range header causes n.read() to be called with an offset= of type 'long',
which eventually got used in a Spans/DataSpans object's __len__ method.
Apparently python doesn't permit __len__() to return longs, only ints.
Rewrote Spans/DataSpans to use s.len() instead of len(s) aka s.__len__() .
Added a test in test_download. Note that test_web didn't catch this because
it uses mock FileNodes for speed: it's probably time to rewrite that.
There is still an unresolved error-recovery problem in #1154 , so I'm not
closing the ticket quite yet.
2010-08-04 11:45:49 -07:00
Brian Warner
919938dd95
copy the rest of David-Sarah's changes to make my tree match 1.8.0beta
2010-08-04 00:27:52 -07:00
Brian Warner
cbcb728e7e
Add a byte-spans utility class, like perl's Set::IntSpan for .newsrc files.
...
Also a data-spans class, which records a byte (instead of a bit) for each
index.
2010-08-04 00:26:00 -07:00
david-sarah
11b18824c7
util.fileutil, test.test_util: add abspath_expanduser_unicode function, to work around < http://bugs.python.org/issue3426 >. util.encodingutil: add a convenience function argv_to_abspath.
2010-07-21 16:15:07 -07:00
Brian Warner
1de4d2c594
test_util.py: improve coverage of util.time_format
2010-02-23 23:46:37 -05:00
Brian Warner
e9223fcd0e
hush pyflakes-0.4.0 warnings: slightly less-trivial fixes. Closes #900 .
...
This includes one fix (in test_web) which was testing the wrong thing.
2010-01-14 14:17:19 -08:00
Brian Warner
731d15e56f
hush pyflakes-0.4.0 warnings: remove trivial unused variables. For #900 .
2010-01-14 14:15:29 -08:00
Brian Warner
d888bf3377
Clean up log.err calls, for one of the issues in #889 .
...
allmydata.util.log.err() either takes a Failure as the first positional
argument, or takes no positional arguments and must be invoked in an
exception handler. Fixed its signature to match both foolscap.logging.log.err
and twisted.python.log.err . Included a brief unit test.
2010-01-11 17:33:43 -08:00
Brian Warner
41bcc9f39e
PipelineError: fix str() on python2.4 . Closes #842 .
2009-11-24 13:25:12 -08:00
Brian Warner
ea373de042
move dirnode.CachingDict to dictutil.AuxValueDict, generalize method names,
...
improve tests. Let dirnode _pack_children accept either dict or AuxValueDict.
2009-10-17 11:00:05 -07:00
Brian Warner
2c5aa12151
test_util: add known-answer tests for hashutil tags
2009-06-17 21:57:09 -07:00
Zooko O'Whielacronx
45928315f6
util: Brian's horrible hack to figure out how much localtime and utctime differ. Now we'll see if it works on Windows.
2009-06-12 13:45:56 -07:00
Zooko O'Whielacronx
4a30c5899c
util: oops, time.tzset() doesn't work on Windows -- hopefully the new "London" unit test passes on Windows when we skip tzset() on platforms that don't have it
2009-06-11 17:09:20 -07:00
Zooko O'Whielacronx
8978cb0738
util: fix time_format.iso_utc_time_to_seconds() so that it works even in London
2009-06-11 15:11:29 -07:00
Zooko O'Whielacronx
3cfc00f5cf
tests: double the timeouts on some tests which time-out on Francois's box
2009-06-08 19:17:53 -07:00
Zooko O'Whielacronx
0bc116b3a2
tests: bump up timeouts so that the tests can finish before timeout on Francois's little arm box
2009-06-08 15:55:57 -07:00
Brian Warner
1863aee0aa
switch to using RemoteException instead of 'wrapped' RemoteReferences. Should fix #653 , the rref-EQ problem
2009-05-21 17:46:32 -07:00
Brian Warner
e76c6b606f
util/pipeline.py: new utility class to manage size-limited work pipelines, for #392
2009-05-18 16:43:26 -07:00
Zooko O'Whielacronx
a07e746d9c
trivial: whitespace
2009-04-03 16:33:02 -07:00
Zooko O'Whielacronx
b12a7f9ee8
leases, time_format: modify time stamping in lease description
...
* emit lease expiry date in ISO-8601'ish format as well as Brian's format
* rename iso_utc_time_to_localseconds() to iso_utc_time_to_seconds()
* add iso_utc_date()
* simplify the body of iso_utc_time_to_seconds()
2009-04-03 15:59:04 -07:00
Brian Warner
01e2032669
hashutil: add constant-time comparison function, to avoid timing attacks when python's short-circuiting data-dependent == operator is used to, say, check a write-enabler
2009-03-22 20:20:55 -07:00
Brian Warner
8c3013c4f7
rrefutil: add check_remote utility function
2009-02-27 00:59:57 -07:00
Brian Warner
1b3e635936
rrefutil: add trap_remote utility and friends
2009-02-27 00:55:24 -07:00
Brian Warner
5c3d7d8e73
stop using RuntimeError in unit tests, for #639
2009-02-22 17:27:22 -07:00
Brian Warner
3235b9630b
test_util: get almost full test coverage of dictutil, starting with the original pyutil tests as a base. The remaining three uncovered lines involve funny cases of ValueOrderedDict that I can't figure out how to get at
2009-02-15 20:32:10 -07:00
Brian Warner
e1380b132b
util/statistics: add tests, fix mean_repair_cost
2009-02-15 16:23:26 -07:00
Shawn Willden
21832280da
Statistics module
...
Added a statistics module for calculating various facets of
share survival statistics.
2009-01-13 20:12:35 -07:00
Zooko O'Whielacronx
a54eba1d80
util: deferredutil: add basic test for deferredutil.gatherResults
...
Also I checked and Twisted 2.4.0 supports .subFailure and the other parts of the API that we require.
2009-01-07 08:13:42 -07:00
Brian Warner
39a41f1d85
util/abbreviate: add abbreviated-size parser
2008-12-01 17:24:12 -07:00
Brian Warner
7391f63fc1
util/abbreviate: little utility to abbreviate seconds and bytes
2008-11-18 20:11:42 -07:00
Brian Warner
c205a54965
util/cachedir.py: add a cache-directory manager class, which expires+deletes unused files after a while
2008-10-30 13:01:20 -07:00
Brian Warner
b73c380cdb
move testutil into test/common_util.py, since it doesn't count as 'code under test' for our pyflakes numbers
2008-10-28 21:28:31 -07:00
Brian Warner
294e3fb682
util: move PollMixin to a separate file (pollmixin.py), so testutil can be moved into test/
2008-10-28 21:15:48 -07:00
Brian Warner
b0a00e0f33
util/time_format.py: accept space separator, add unit tests
2008-10-13 15:52:58 -07:00
Brian Warner
15a9f3d01b
test_util: improve ConcurrencyLimiter tests
2008-05-07 17:00:47 -07:00
Brian Warner
c7e441309d
add a basic concurrency limiter utility
2008-05-07 16:53:30 -07:00
Zooko O'Whielacronx
fc3bd0c987
use added secret to protect convergent encryption
...
Now upload or encode methods take a required argument named "convergence" which can be either None, indicating no convergent encryption at all, or a string, which is the "added secret" to be mixed in to the content hash key. If you want traditional convergent encryption behavior, set the added secret to be the empty string.
This patch also renames "content hash key" to "convergent encryption" in a argument names and variable names. (A different and larger renaming is needed in order to clarify that Tahoe supports immutable files which are not encrypted content-hash-key a.k.a. convergent encryption.)
This patch also changes a few unit tests to use non-convergent encryption, because it doesn't matter for what they are testing and non-convergent encryption is slightly faster.
2008-03-24 09:46:06 -07:00
Brian Warner
4daa817502
test_util.py: get 100% test coverage for hashutil.py
2008-03-04 14:42:25 -07:00
Brian Warner
72874390fe
BIG COMPATIBILITY BREAK: update hash tags, switch to SHA-256d everywhere
2008-02-14 19:58:01 -07:00
Zooko O'Whielacronx
5942fca1e1
add unit test asserting that allmydata.util.base32 matches rfc 3548
2008-02-14 20:20:19 -07:00
Zooko O'Whielacronx
3eb95c1fad
merge patch which adds base32 to test_util with patch which removes bencode from test_util
2008-02-14 19:35:32 -07:00
Brian Warner
09bfa3bea2
remove bencode, yay
2008-02-14 18:06:41 -07:00
Zooko O'Whielacronx
7c6de95bc6
switch from base62 to base32 for storage indices, switch from z-base-32 to rfc 3548 base-32 for everything, separate out base32 encoding from idlib
2008-02-14 19:27:47 -07:00
Brian Warner
da9610e90a
change encryption-key hash to include encoding parameters. This is a minor compatibility break: CHK files encoded (with convergence) before and after this will have different keys and ciphertexts. Also switched to SHA-256d for both the data-to-key hash and the key-to-storageindex hash
2008-02-06 19:50:47 -07:00
Brian Warner
9f9a458249
hashutil: add tagged_hash_256d and tagged_hasher_256d
2008-02-06 19:36:43 -07:00
Brian Warner
d87bfa9eb2
test_util: add full coverage for allmydata.util.deferredutil
2008-02-06 16:41:04 -07:00
Brian Warner
3a5ba35215
PollMixin: add timeout= argument, rewrite to avoid tail-recursion problems
2008-02-04 20:35:07 -07:00