annotate tests/test-encode.t @ 51928:ad83e4f9b40e

typing: correct pytype mistakes in `mercurial/vfs.py` With the previous changes in this series (prior to merging the *.pyi file), this wasn't too bad- the only definitively wrong things were the `data` argument to `writelines()`, and the return type on `backgroundclosing()` (both of these errors were dropped in the previous commit; for some reason pytype doesn't like `contextlib._GeneratorContextManager`, even though that's what it determined it is): File "/mnt/c/Users/Matt/hg/mercurial/vfs.py", line 411, in abstractvfs: Bad return type 'contextlib._GeneratorContextManager' for generator function abstractvfs.backgroundclosing [bad-yield-annotation] Expected Generator, Iterable or Iterator PyCharm thinks this is `Generator[backgroundfilecloser], Any, None]`, which can be reduced to `Iterator[backgroundfilecloser]`, but pytype flagged the line that calls `yield` without an argument unless it's also `Optional`. PyCharm is happy either way. For some reason, `Iterable` didn't work for pytype: File "/mnt/c/Users/Matt/hg/mercurial/vfs.py", line 390, in abstractvfs: Function contextlib.contextmanager was called with the wrong arguments [wrong-arg-types] Expected: (func: Callable[[Any], Iterator]) Actually passed: (func: Callable[[Any, Any, Any], Iterable[Optional[Any]]]) Attributes of protocol Iterator[_T_co] are not implemented on Iterable[Optional[Any]]: __next__
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 20 Sep 2024 16:36:28 -0400
parents 55c6ebd11cb9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12416
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
1 Test encode/decode filters
1258
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
2
49585
55c6ebd11cb9 tests: run many tests in $TESTTMP/repo instead of $TESTTMP
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 48388
diff changeset
3 $ hg init repo
55c6ebd11cb9 tests: run many tests in $TESTTMP/repo instead of $TESTTMP
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 48388
diff changeset
4 $ cd repo
12416
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
5 $ cat > .hg/hgrc <<EOF
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
6 > [encode]
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
7 > not.gz = tr [:lower:] [:upper:]
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
8 > *.gz = gzip -d
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
9 > [decode]
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
10 > not.gz = tr [:upper:] [:lower:]
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
11 > *.gz = gzip
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
12 > EOF
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
13 $ echo "this is a test" | gzip > a.gz
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
14 $ echo "this is a test" > not.gz
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
15 $ hg add *
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
16 $ hg ci -m "test"
1258
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
17
12416
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
18 no changes
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
19
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
20 $ hg status
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
21 $ touch *
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
22
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
23 no changes
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
24
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
25 $ hg status
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
26
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
27 check contents in repo are encoded
1258
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
28
14182
ec5886db9dc6 tests: fix deprecated use of hg debugdata/debugindex
Sune Foldager <cryo@cyanite.org>
parents: 12416
diff changeset
29 $ hg debugdata a.gz 0
12416
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
30 this is a test
14182
ec5886db9dc6 tests: fix deprecated use of hg debugdata/debugindex
Sune Foldager <cryo@cyanite.org>
parents: 12416
diff changeset
31 $ hg debugdata not.gz 0
12416
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
32 THIS IS A TEST
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
33
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
34 check committed content was decoded
1258
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
35
12416
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
36 $ gunzip < a.gz
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
37 this is a test
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
38 $ cat not.gz
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
39 this is a test
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
40 $ rm *
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
41 $ hg co -C
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
42 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1258
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
43
12416
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
44 check decoding of our new working dir copy
1258
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
45
12416
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
46 $ gunzip < a.gz
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
47 this is a test
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
48 $ cat not.gz
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
49 this is a test
1258
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
50
12416
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
51 check hg cat operation
6093
f5b00b6e426a Option --decode for hg cat to apply decode filters.
Jesse Glick <jesse.glick@sun.com>
parents: 3853
diff changeset
52
12416
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
53 $ hg cat a.gz
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
54 this is a test
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
55 $ hg cat --decode a.gz | gunzip
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
56 this is a test
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
57 $ mkdir subdir
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
58 $ cd subdir
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
59 $ hg -R .. cat ../a.gz
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
60 this is a test
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
61 $ hg -R .. cat --decode ../a.gz | gunzip
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
62 this is a test
37461
538353b80676 procutil: fix error message of tempfile filter
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
63 $ cd ..
538353b80676 procutil: fix error message of tempfile filter
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
64
538353b80676 procutil: fix error message of tempfile filter
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
65 check tempfile filter
538353b80676 procutil: fix error message of tempfile filter
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
66
538353b80676 procutil: fix error message of tempfile filter
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
67 $ hg cat a.gz --decode --config 'decode.*.gz=tempfile:gzip -c INFILE > OUTFILE' | gunzip
538353b80676 procutil: fix error message of tempfile filter
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
68 this is a test
538353b80676 procutil: fix error message of tempfile filter
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
69 $ hg cat a.gz --decode --config 'decode.*.gz=tempfile:sh -c "exit 1"'
538353b80676 procutil: fix error message of tempfile filter
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
70 abort: command '*' failed: exited with status 1 (glob)
538353b80676 procutil: fix error message of tempfile filter
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
71 [255]
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 14182
diff changeset
72
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 14182
diff changeset
73 $ cd ..