diff options
author | Nikita Slyusarev <nslus@yandex-team.com> | 2022-02-10 16:46:53 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:53 +0300 |
commit | 469afdc4e2587bf62ecdd096b75a0baa444c4012 (patch) | |
tree | 49e222ea1c5804306084bb3ae065bb702625360f /library | |
parent | cd77cecfc03a3eaf87816af28a33067c4f0cdb59 (diff) | |
download | ydb-469afdc4e2587bf62ecdd096b75a0baa444c4012.tar.gz |
Restoring authorship annotation for Nikita Slyusarev <nslus@yandex-team.com>. Commit 2 of 2.
Diffstat (limited to 'library')
171 files changed, 2143 insertions, 2143 deletions
diff --git a/library/cpp/accurate_accumulate/benchmark/metrics/ya.make b/library/cpp/accurate_accumulate/benchmark/metrics/ya.make index 724d942956..5d532e1479 100644 --- a/library/cpp/accurate_accumulate/benchmark/metrics/ya.make +++ b/library/cpp/accurate_accumulate/benchmark/metrics/ya.make @@ -1,4 +1,4 @@ -OWNER(yazevnul) +OWNER(yazevnul) PY2TEST() @@ -10,7 +10,7 @@ TAG( ya:fat ) -TEST_SRCS(main.py) +TEST_SRCS(main.py) DEPENDS(library/cpp/accurate_accumulate/benchmark) diff --git a/library/cpp/accurate_accumulate/benchmark/ya.make b/library/cpp/accurate_accumulate/benchmark/ya.make index 07832861b3..20fd877389 100644 --- a/library/cpp/accurate_accumulate/benchmark/ya.make +++ b/library/cpp/accurate_accumulate/benchmark/ya.make @@ -1,4 +1,4 @@ -OWNER(yazevnul) +OWNER(yazevnul) Y_BENCHMARK() diff --git a/library/cpp/actors/core/ut/ya.make b/library/cpp/actors/core/ut/ya.make index 0badab9fc4..3ee28d5850 100644 --- a/library/cpp/actors/core/ut/ya.make +++ b/library/cpp/actors/core/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/actors/core) -OWNER( - alexvru - g:kikimr -) +OWNER( + alexvru + g:kikimr +) FORK_SUBTESTS() IF (SANITIZER_TYPE) @@ -21,7 +21,7 @@ ELSE() ram:16 ) ENDIF() - + PEERDIR( library/cpp/actors/interconnect diff --git a/library/cpp/actors/core/ya.make b/library/cpp/actors/core/ya.make index 92d6456e0b..880a9d00db 100644 --- a/library/cpp/actors/core/ya.make +++ b/library/cpp/actors/core/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - ddoarn - g:kikimr -) +OWNER( + ddoarn + g:kikimr +) NO_WSHADOW() @@ -12,10 +12,10 @@ IF (PROFILE_MEMORY_ALLOCATIONS) ENDIF() IF (ALLOCATOR == "B" OR ALLOCATOR == "BS" OR ALLOCATOR == "C") - CXXFLAGS(-DBALLOC) - PEERDIR( + CXXFLAGS(-DBALLOC) + PEERDIR( library/cpp/balloc/optional - ) + ) ENDIF() SRCS( diff --git a/library/cpp/actors/helpers/ya.make b/library/cpp/actors/helpers/ya.make index 9cf85b3641..d8771179de 100644 --- a/library/cpp/actors/helpers/ya.make +++ b/library/cpp/actors/helpers/ya.make @@ -1,6 +1,6 @@ LIBRARY() -OWNER(g:kikimr) +OWNER(g:kikimr) SRCS( activeactors.cpp diff --git a/library/cpp/actors/interconnect/ut/ya.make b/library/cpp/actors/interconnect/ut/ya.make index bd912e9822..2f5b13352e 100644 --- a/library/cpp/actors/interconnect/ut/ya.make +++ b/library/cpp/actors/interconnect/ut/ya.make @@ -2,7 +2,7 @@ UNITTEST() OWNER( alexvru - g:kikimr + g:kikimr ) IF (SANITIZER_TYPE == "thread") diff --git a/library/cpp/actors/memory_log/ya.make b/library/cpp/actors/memory_log/ya.make index 3808dde443..d89d5db4d7 100644 --- a/library/cpp/actors/memory_log/ya.make +++ b/library/cpp/actors/memory_log/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - agri - g:kikimr -) +OWNER( + agri + g:kikimr +) SRCS( memlog.cpp diff --git a/library/cpp/actors/prof/ut/ya.make b/library/cpp/actors/prof/ut/ya.make index 9db075103c..47c58a8fb7 100644 --- a/library/cpp/actors/prof/ut/ya.make +++ b/library/cpp/actors/prof/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/actors/prof) -OWNER( - agri - g:kikimr -) +OWNER( + agri + g:kikimr +) SRCS( tag_ut.cpp diff --git a/library/cpp/actors/prof/ya.make b/library/cpp/actors/prof/ya.make index e6bec000d0..b5e2497563 100644 --- a/library/cpp/actors/prof/ya.make +++ b/library/cpp/actors/prof/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - agri - g:kikimr -) +OWNER( + agri + g:kikimr +) SRCS( tag.cpp @@ -15,7 +15,7 @@ PEERDIR( ) IF (PROFILE_MEMORY_ALLOCATIONS) - CFLAGS(-DPROFILE_MEMORY_ALLOCATIONS) + CFLAGS(-DPROFILE_MEMORY_ALLOCATIONS) PEERDIR( library/cpp/malloc/api library/cpp/lfalloc/dbg_info diff --git a/library/cpp/actors/util/ut/ya.make b/library/cpp/actors/util/ut/ya.make index bccb98d794..3b08b77984 100644 --- a/library/cpp/actors/util/ut/ya.make +++ b/library/cpp/actors/util/ut/ya.make @@ -5,10 +5,10 @@ IF (WITH_VALGRIND) SIZE(MEDIUM) ENDIF() -OWNER( - alexvru - g:kikimr -) +OWNER( + alexvru + g:kikimr +) SRCS( rope_ut.cpp diff --git a/library/cpp/actors/wilson/ya.make b/library/cpp/actors/wilson/ya.make index 21be05f5b7..e371f5061d 100644 --- a/library/cpp/actors/wilson/ya.make +++ b/library/cpp/actors/wilson/ya.make @@ -1,14 +1,14 @@ LIBRARY() -PEERDIR( +PEERDIR( library/cpp/string_utils/base64 -) - -OWNER(alexvru) - -SRCS( - wilson_event.h - wilson_trace.h -) - +) + +OWNER(alexvru) + +SRCS( + wilson_event.h + wilson_trace.h +) + END() diff --git a/library/cpp/blockcodecs/fuzz/ya.make b/library/cpp/blockcodecs/fuzz/ya.make index ebcf569bb7..bc8becc9e1 100644 --- a/library/cpp/blockcodecs/fuzz/ya.make +++ b/library/cpp/blockcodecs/fuzz/ya.make @@ -1,7 +1,7 @@ -OWNER( - pg - g:util -) +OWNER( + pg + g:util +) IF (NOT MSVC) FUZZ() diff --git a/library/cpp/blockcodecs/ut/ya.make b/library/cpp/blockcodecs/ut/ya.make index 136fdcb187..25b882c15b 100644 --- a/library/cpp/blockcodecs/ut/ya.make +++ b/library/cpp/blockcodecs/ut/ya.make @@ -3,11 +3,11 @@ UNITTEST_FOR(library/cpp/blockcodecs) OWNER(pg) FORK_TESTS() - + FORK_SUBTESTS() - + SPLIT_FACTOR(40) - + TIMEOUT(300) SIZE(MEDIUM) diff --git a/library/cpp/build_info/ya.make b/library/cpp/build_info/ya.make index 0c0f9d50b0..99886a8893 100644 --- a/library/cpp/build_info/ya.make +++ b/library/cpp/build_info/ya.make @@ -9,7 +9,7 @@ OWNER( DEFAULT(SANDBOX_TASK_ID 0) DEFAULT(KOSHER_SVN_VERSION "") -CREATE_BUILDINFO_FOR(buildinfo_data.h) +CREATE_BUILDINFO_FOR(buildinfo_data.h) PEERDIR( library/cpp/string_utils/base64 diff --git a/library/cpp/cgiparam/fuzz/ya.make b/library/cpp/cgiparam/fuzz/ya.make index ab634f4844..8fb9d50d3b 100644 --- a/library/cpp/cgiparam/fuzz/ya.make +++ b/library/cpp/cgiparam/fuzz/ya.make @@ -1,9 +1,9 @@ FUZZ() -OWNER( - pg - g:util -) +OWNER( + pg + g:util +) SRCS( main.cpp diff --git a/library/cpp/codecs/static/example/ya.make b/library/cpp/codecs/static/example/ya.make index 67342d3083..ca6c5fd900 100644 --- a/library/cpp/codecs/static/example/ya.make +++ b/library/cpp/codecs/static/example/ya.make @@ -12,13 +12,13 @@ PEERDIR( ) ARCHIVE_ASM( - "solar-8k-a.huffman.1467494385.codec_info" - NAME codec_info_sa_huff_20160707 + "solar-8k-a.huffman.1467494385.codec_info" + NAME codec_info_sa_huff_20160707 ) ARCHIVE_ASM( - "huffman.1467494385.codec_info" - NAME codec_info_huff_20160707 + "huffman.1467494385.codec_info" + NAME codec_info_huff_20160707 ) END() diff --git a/library/cpp/codecs/static/tools/common/ya.make b/library/cpp/codecs/static/tools/common/ya.make index 3381c4b896..d624222dad 100644 --- a/library/cpp/codecs/static/tools/common/ya.make +++ b/library/cpp/codecs/static/tools/common/ya.make @@ -1,6 +1,6 @@ LIBRARY() -OWNER(velavokr) +OWNER(velavokr) SRCS( ct_common.cpp @@ -14,6 +14,6 @@ PEERDIR( util/draft ) -GENERATE_ENUM_SERIALIZATION(ct_common.h) +GENERATE_ENUM_SERIALIZATION(ct_common.h) END() diff --git a/library/cpp/codecs/static/tools/static_codec_checker/ya.make b/library/cpp/codecs/static/tools/static_codec_checker/ya.make index 968880a781..90e06ca448 100644 --- a/library/cpp/codecs/static/tools/static_codec_checker/ya.make +++ b/library/cpp/codecs/static/tools/static_codec_checker/ya.make @@ -1,6 +1,6 @@ PROGRAM() -OWNER(velavokr) +OWNER(velavokr) SRCS( static_codec_checker.cpp diff --git a/library/cpp/codecs/static/tools/static_codec_generator/ya.make b/library/cpp/codecs/static/tools/static_codec_generator/ya.make index aa786f8886..efbc440dd1 100644 --- a/library/cpp/codecs/static/tools/static_codec_generator/ya.make +++ b/library/cpp/codecs/static/tools/static_codec_generator/ya.make @@ -1,6 +1,6 @@ PROGRAM() -OWNER(velavokr) +OWNER(velavokr) SRCS( static_codec_generator.cpp diff --git a/library/cpp/comptable/usage/ya.make b/library/cpp/comptable/usage/ya.make index 909e21d17c..ab31e7528c 100644 --- a/library/cpp/comptable/usage/ya.make +++ b/library/cpp/comptable/usage/ya.make @@ -2,12 +2,12 @@ PROGRAM() OWNER(ironpeter) -SRCS( - usage.cpp -) +SRCS( + usage.cpp +) -PEERDIR( +PEERDIR( library/cpp/comptable -) +) END() diff --git a/library/cpp/comptable/ut/ya.make b/library/cpp/comptable/ut/ya.make index ae777d6b6b..d0a49793a5 100644 --- a/library/cpp/comptable/ut/ya.make +++ b/library/cpp/comptable/ut/ya.make @@ -2,8 +2,8 @@ UNITTEST_FOR(library/cpp/comptable) OWNER(ironpeter) -SRCS( - comptable_ut.cpp -) +SRCS( + comptable_ut.cpp +) END() diff --git a/library/cpp/comptable/ya.make b/library/cpp/comptable/ya.make index 270f086d30..314603c62a 100644 --- a/library/cpp/comptable/ya.make +++ b/library/cpp/comptable/ya.make @@ -2,12 +2,12 @@ LIBRARY() OWNER(ironpeter) -SRCS( - comptable.cpp -) +SRCS( + comptable.cpp +) -PEERDIR( +PEERDIR( library/cpp/compproto -) +) END() diff --git a/library/cpp/containers/comptrie/loader/ut/ya.make b/library/cpp/containers/comptrie/loader/ut/ya.make index 4b57a4f10e..6c0334d3ea 100644 --- a/library/cpp/containers/comptrie/loader/ut/ya.make +++ b/library/cpp/containers/comptrie/loader/ut/ya.make @@ -1,6 +1,6 @@ UNITTEST_FOR(library/cpp/containers/comptrie/loader) -OWNER(my34) +OWNER(my34) ARCHIVE( NAME data.inc diff --git a/library/cpp/containers/intrusive_avl_tree/ut/ya.make b/library/cpp/containers/intrusive_avl_tree/ut/ya.make index 0d9c8732f6..87920306d7 100644 --- a/library/cpp/containers/intrusive_avl_tree/ut/ya.make +++ b/library/cpp/containers/intrusive_avl_tree/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/containers/intrusive_avl_tree) -OWNER( - pg - g:util -) +OWNER( + pg + g:util +) SRCS( avltree_ut.cpp diff --git a/library/cpp/containers/intrusive_avl_tree/ya.make b/library/cpp/containers/intrusive_avl_tree/ya.make index 502848a8a9..6b061f2760 100644 --- a/library/cpp/containers/intrusive_avl_tree/ya.make +++ b/library/cpp/containers/intrusive_avl_tree/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - pg - g:util -) +OWNER( + pg + g:util +) SRCS( avltree.cpp diff --git a/library/cpp/containers/intrusive_rb_tree/fuzz/ya.make b/library/cpp/containers/intrusive_rb_tree/fuzz/ya.make index ed6ed129a0..61be9919e6 100644 --- a/library/cpp/containers/intrusive_rb_tree/fuzz/ya.make +++ b/library/cpp/containers/intrusive_rb_tree/fuzz/ya.make @@ -1,12 +1,12 @@ FUZZ() -OWNER( - g:util - mikari -) +OWNER( + g:util + mikari +) SIZE(LARGE) - + TAG(ya:fat) PEERDIR( diff --git a/library/cpp/containers/intrusive_rb_tree/ut/ya.make b/library/cpp/containers/intrusive_rb_tree/ut/ya.make index 05dd5121ba..6f1e3b38ee 100644 --- a/library/cpp/containers/intrusive_rb_tree/ut/ya.make +++ b/library/cpp/containers/intrusive_rb_tree/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/containers/intrusive_rb_tree) -OWNER( - pg - g:util -) +OWNER( + pg + g:util +) SRCS( rb_tree_ut.cpp diff --git a/library/cpp/containers/intrusive_rb_tree/ya.make b/library/cpp/containers/intrusive_rb_tree/ya.make index 31cd275585..2e5eddcfbe 100644 --- a/library/cpp/containers/intrusive_rb_tree/ya.make +++ b/library/cpp/containers/intrusive_rb_tree/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - pg - g:util -) +OWNER( + pg + g:util +) SRCS( rb_tree.cpp diff --git a/library/cpp/containers/ring_buffer/ya.make b/library/cpp/containers/ring_buffer/ya.make index 7d8c0f8fa1..51333978f7 100644 --- a/library/cpp/containers/ring_buffer/ya.make +++ b/library/cpp/containers/ring_buffer/ya.make @@ -1,4 +1,4 @@ -OWNER(mowgli) +OWNER(mowgli) LIBRARY() diff --git a/library/cpp/coroutine/engine/ya.make b/library/cpp/coroutine/engine/ya.make index ce6c48fe19..8c20b9afc3 100644 --- a/library/cpp/coroutine/engine/ya.make +++ b/library/cpp/coroutine/engine/ya.make @@ -5,7 +5,7 @@ OWNER( g:balancer ) -GENERATE_ENUM_SERIALIZATION(poller.h) +GENERATE_ENUM_SERIALIZATION(poller.h) GENERATE_ENUM_SERIALIZATION(stack/stack_common.h) PEERDIR( diff --git a/library/cpp/deprecated/enum_codegen/ut/ya.make b/library/cpp/deprecated/enum_codegen/ut/ya.make index 8f0c08a35c..32e7ad77a2 100644 --- a/library/cpp/deprecated/enum_codegen/ut/ya.make +++ b/library/cpp/deprecated/enum_codegen/ut/ya.make @@ -4,10 +4,10 @@ OWNER(g:util) SRCDIR(library/cpp/deprecated/enum_codegen) -PEERDIR( +PEERDIR( library/cpp/deprecated/enum_codegen -) - +) + SRCS( enum_codegen_ut.cpp ) diff --git a/library/cpp/diff/ya.make b/library/cpp/diff/ya.make index 5230cad6e9..a05b7ccbbc 100644 --- a/library/cpp/diff/ya.make +++ b/library/cpp/diff/ya.make @@ -2,12 +2,12 @@ LIBRARY() OWNER(antonovvk) -PEERDIR( +PEERDIR( library/cpp/lcs library/cpp/containers/stack_array ) -SRCS( +SRCS( diff.cpp ) diff --git a/library/cpp/digest/argonish/benchmark/ya.make b/library/cpp/digest/argonish/benchmark/ya.make index a36422e05c..5aad1b238f 100644 --- a/library/cpp/digest/argonish/benchmark/ya.make +++ b/library/cpp/digest/argonish/benchmark/ya.make @@ -2,12 +2,12 @@ OWNER(e-sidorov) Y_BENCHMARK() -PEERDIR( +PEERDIR( library/cpp/digest/argonish -) +) -SRCS( - mbench.cpp -) +SRCS( + mbench.cpp +) END() diff --git a/library/cpp/digest/argonish/internal/blake2b/ya.make b/library/cpp/digest/argonish/internal/blake2b/ya.make index 9f9a73ee3c..0aa6806b31 100644 --- a/library/cpp/digest/argonish/internal/blake2b/ya.make +++ b/library/cpp/digest/argonish/internal/blake2b/ya.make @@ -2,8 +2,8 @@ LIBRARY() OWNER(e-sidorov) -PEERDIR( +PEERDIR( library/cpp/digest/argonish/internal/rotations -) +) END() diff --git a/library/cpp/digest/argonish/internal/blamka/ya.make b/library/cpp/digest/argonish/internal/blamka/ya.make index 9f9a73ee3c..0aa6806b31 100644 --- a/library/cpp/digest/argonish/internal/blamka/ya.make +++ b/library/cpp/digest/argonish/internal/blamka/ya.make @@ -2,8 +2,8 @@ LIBRARY() OWNER(e-sidorov) -PEERDIR( +PEERDIR( library/cpp/digest/argonish/internal/rotations -) +) END() diff --git a/library/cpp/digest/argonish/ut/ya.make b/library/cpp/digest/argonish/ut/ya.make index 9889c297de..3440908799 100644 --- a/library/cpp/digest/argonish/ut/ya.make +++ b/library/cpp/digest/argonish/ut/ya.make @@ -2,12 +2,12 @@ UNITTEST_FOR(library/cpp/digest/argonish) OWNER(e-sidorov) -PEERDIR( +PEERDIR( library/cpp/digest/argonish -) +) -SRCS( - ut.cpp -) +SRCS( + ut.cpp +) END() diff --git a/library/cpp/digest/argonish/ut_fat/ya.make b/library/cpp/digest/argonish/ut_fat/ya.make index c2a67352a0..94ebda9225 100644 --- a/library/cpp/digest/argonish/ut_fat/ya.make +++ b/library/cpp/digest/argonish/ut_fat/ya.make @@ -2,20 +2,20 @@ UNITTEST_FOR(library/cpp/digest/argonish) OWNER(e-sidorov) -PEERDIR( +PEERDIR( library/cpp/digest/argonish -) +) SRCS( ut.cpp ) -TAG( - sb:intel_e5_2660v4 - ya:fat - ya:force_sandbox -) - +TAG( + sb:intel_e5_2660v4 + ya:fat + ya:force_sandbox +) + SIZE(LARGE) END() diff --git a/library/cpp/digest/lower_case/ut/ya.make b/library/cpp/digest/lower_case/ut/ya.make index b1fb7a6145..f083257b3d 100644 --- a/library/cpp/digest/lower_case/ut/ya.make +++ b/library/cpp/digest/lower_case/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/digest/lower_case) -OWNER( - pg - g:util -) +OWNER( + pg + g:util +) SRCS( lchash_ut.cpp diff --git a/library/cpp/digest/md5/bench/ya.make b/library/cpp/digest/md5/bench/ya.make index 00099ab126..5c3e3c1c42 100644 --- a/library/cpp/digest/md5/bench/ya.make +++ b/library/cpp/digest/md5/bench/ya.make @@ -1,9 +1,9 @@ G_BENCHMARK() -OWNER( - pg - g:util -) +OWNER( + pg + g:util +) PEERDIR( library/cpp/digest/md5 diff --git a/library/cpp/digest/md5/medium_ut/ya.make b/library/cpp/digest/md5/medium_ut/ya.make index 65fad6b606..418c57f086 100644 --- a/library/cpp/digest/md5/medium_ut/ya.make +++ b/library/cpp/digest/md5/medium_ut/ya.make @@ -1,13 +1,13 @@ UNITTEST_FOR(library/cpp/digest/md5) SIZE(MEDIUM) - + TIMEOUT(120) -OWNER( - pg - g:util -) +OWNER( + pg + g:util +) SRCS( md5_medium_ut.cpp diff --git a/library/cpp/digest/md5/ut/ya.make b/library/cpp/digest/md5/ut/ya.make index 32b80ca1c1..ad1eddbff2 100644 --- a/library/cpp/digest/md5/ut/ya.make +++ b/library/cpp/digest/md5/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/digest/md5) -OWNER( - pg - g:util -) +OWNER( + pg + g:util +) SRCS( md5_ut.cpp diff --git a/library/cpp/digest/md5/ya.make b/library/cpp/digest/md5/ya.make index cec46c2aba..c09ec1c326 100644 --- a/library/cpp/digest/md5/ya.make +++ b/library/cpp/digest/md5/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - pg - g:util -) +OWNER( + pg + g:util +) SRCS( md5.cpp diff --git a/library/cpp/digest/old_crc/crc.cpp b/library/cpp/digest/old_crc/crc.cpp index 3d3f17142a..994755f34d 100644 --- a/library/cpp/digest/old_crc/crc.cpp +++ b/library/cpp/digest/old_crc/crc.cpp @@ -1,7 +1,7 @@ #include "crc.h" #include <library/cpp/digest/old_crc/crc.inc> - + #include <util/system/defaults.h> static const ui64 CRCTAB64[256] = { diff --git a/library/cpp/digest/old_crc/ut/ya.make b/library/cpp/digest/old_crc/ut/ya.make index 7bc044fb34..a783bbae5b 100644 --- a/library/cpp/digest/old_crc/ut/ya.make +++ b/library/cpp/digest/old_crc/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/digest/old_crc) -OWNER( - pg - g:util -) +OWNER( + pg + g:util +) SRCS( crc_ut.cpp diff --git a/library/cpp/digest/old_crc/ya.make b/library/cpp/digest/old_crc/ya.make index 737390600a..aa6ea8f6c5 100644 --- a/library/cpp/digest/old_crc/ya.make +++ b/library/cpp/digest/old_crc/ya.make @@ -1,17 +1,17 @@ LIBRARY() -OWNER( - pg - g:util -) +OWNER( + pg + g:util +) SRCS( crc.cpp ) -RUN_PROGRAM( +RUN_PROGRAM( library/cpp/digest/old_crc/gencrc - STDOUT crc.inc -) + STDOUT crc.inc +) END() diff --git a/library/cpp/digest/sfh/ut/ya.make b/library/cpp/digest/sfh/ut/ya.make index 09e358e746..256a66295a 100644 --- a/library/cpp/digest/sfh/ut/ya.make +++ b/library/cpp/digest/sfh/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/digest/sfh) -OWNER( - pg - g:util -) +OWNER( + pg + g:util +) SRCS( sfh_ut.cpp diff --git a/library/cpp/digest/sfh/ya.make b/library/cpp/digest/sfh/ya.make index 8b711eed21..b906cd1577 100644 --- a/library/cpp/digest/sfh/ya.make +++ b/library/cpp/digest/sfh/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - pg - g:util -) +OWNER( + pg + g:util +) SRCS( sfh.cpp diff --git a/library/cpp/histogram/adaptive/protos/python/ya.make b/library/cpp/histogram/adaptive/protos/python/ya.make index 403d3f56d0..3328c27965 100644 --- a/library/cpp/histogram/adaptive/protos/python/ya.make +++ b/library/cpp/histogram/adaptive/protos/python/ya.make @@ -1,3 +1,3 @@ -OWNER(abogutskiy) +OWNER(abogutskiy) PY_PROTOS_FOR(library/cpp/histogram/adaptive/protos) diff --git a/library/cpp/histogram/hdr/ut/ya.make b/library/cpp/histogram/hdr/ut/ya.make index de6788a95a..13ceb143c8 100644 --- a/library/cpp/histogram/hdr/ut/ya.make +++ b/library/cpp/histogram/hdr/ut/ya.make @@ -1,7 +1,7 @@ -OWNER( - g:util - jamel -) +OWNER( + g:util + jamel +) UNITTEST_FOR(library/cpp/histogram/hdr) diff --git a/library/cpp/histogram/hdr/ya.make b/library/cpp/histogram/hdr/ya.make index 81a2efd033..885099608d 100644 --- a/library/cpp/histogram/hdr/ya.make +++ b/library/cpp/histogram/hdr/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - g:util - jamel -) +OWNER( + g:util + jamel +) SRCS( histogram.cpp diff --git a/library/cpp/html/escape/ut/ya.make b/library/cpp/html/escape/ut/ya.make index c854d6d1ce..27d3a3d65a 100644 --- a/library/cpp/html/escape/ut/ya.make +++ b/library/cpp/html/escape/ut/ya.make @@ -1,5 +1,5 @@ UNITTEST() - + OWNER(stanly) SRCS( diff --git a/library/cpp/html/escape/ya.make b/library/cpp/html/escape/ya.make index b075e7acd4..93a31e33d6 100644 --- a/library/cpp/html/escape/ya.make +++ b/library/cpp/html/escape/ya.make @@ -1,5 +1,5 @@ LIBRARY() - + OWNER(stanly) SRCS( diff --git a/library/cpp/http/fetch/ya.make b/library/cpp/http/fetch/ya.make index e0de1e8bc2..7737127463 100644 --- a/library/cpp/http/fetch/ya.make +++ b/library/cpp/http/fetch/ya.make @@ -34,5 +34,5 @@ GENERATE_ENUM_SERIALIZATION(httpheader.h) SET(RAGEL6_FLAGS -CF1) END() - + RECURSE_FOR_TESTS(ut) diff --git a/library/cpp/http/io/fuzz/ya.make b/library/cpp/http/io/fuzz/ya.make index e480f7f2ef..8b3ccb1969 100644 --- a/library/cpp/http/io/fuzz/ya.make +++ b/library/cpp/http/io/fuzz/ya.make @@ -1,9 +1,9 @@ FUZZ() -OWNER( - pg - g:util -) +OWNER( + pg + g:util +) PEERDIR( library/cpp/http/io diff --git a/library/cpp/int128/ya.make b/library/cpp/int128/ya.make index 2a29f01143..95e453e6f1 100644 --- a/library/cpp/int128/ya.make +++ b/library/cpp/int128/ya.make @@ -2,7 +2,7 @@ LIBRARY() OWNER( vladon - # g:zora + # g:zora ) SRCS( diff --git a/library/cpp/json/fast_sax/ya.make b/library/cpp/json/fast_sax/ya.make index 2419d1a935..c6447ab6ac 100644 --- a/library/cpp/json/fast_sax/ya.make +++ b/library/cpp/json/fast_sax/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - pg - velavokr -) +OWNER( + pg + velavokr +) PEERDIR( library/cpp/json/common diff --git a/library/cpp/json/flex_buffers/ya.make b/library/cpp/json/flex_buffers/ya.make index fa00f73ca9..3ece5e3703 100644 --- a/library/cpp/json/flex_buffers/ya.make +++ b/library/cpp/json/flex_buffers/ya.make @@ -2,7 +2,7 @@ LIBRARY() OWNER(pg) -ADDINCL(contrib/libs/flatbuffers/include) +ADDINCL(contrib/libs/flatbuffers/include) PEERDIR( library/cpp/json diff --git a/library/cpp/json/ut/json_reader_ut.cpp b/library/cpp/json/ut/json_reader_ut.cpp index 932793d9b5..cd31afa0b8 100644 --- a/library/cpp/json/ut/json_reader_ut.cpp +++ b/library/cpp/json/ut/json_reader_ut.cpp @@ -354,24 +354,24 @@ Y_UNIT_TEST_SUITE(TJsonReaderTest) { UNIT_ASSERT_EQUAL(value["test"].GetDoubleRobust(), static_cast<double>(Max<ui64>())); } // Max<ui64>() } // TJsonDoubleTest - + Y_UNIT_TEST(TJsonInvalidTest) { - { - // No exceptions mode. - TStringStream in; - in << "{ \"test\" : }"; - TJsonValue value; - UNIT_ASSERT(!ReadJsonTree(&in, &value)); - } - - { - // Exception throwing mode. - TStringStream in; - in << "{ \"test\" : }"; - TJsonValue value; - UNIT_ASSERT_EXCEPTION(ReadJsonTree(&in, &value, true), TJsonException); - } - } + { + // No exceptions mode. + TStringStream in; + in << "{ \"test\" : }"; + TJsonValue value; + UNIT_ASSERT(!ReadJsonTree(&in, &value)); + } + + { + // Exception throwing mode. + TStringStream in; + in << "{ \"test\" : }"; + TJsonValue value; + UNIT_ASSERT_EXCEPTION(ReadJsonTree(&in, &value, true), TJsonException); + } + } Y_UNIT_TEST(TJsonMemoryLeakTest) { // after https://clubs.at.yandex-team.ru/stackoverflow/3691 diff --git a/library/cpp/json/writer/ya.make b/library/cpp/json/writer/ya.make index 47999a85c1..3989ff3504 100644 --- a/library/cpp/json/writer/ya.make +++ b/library/cpp/json/writer/ya.make @@ -1,10 +1,10 @@ LIBRARY() -OWNER( - mvel - myltsev - pg -) +OWNER( + mvel + myltsev + pg +) PEERDIR( library/cpp/json/common diff --git a/library/cpp/json/ya.make b/library/cpp/json/ya.make index 7add7496b7..d58eead8ec 100644 --- a/library/cpp/json/ya.make +++ b/library/cpp/json/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - pg - velavokr -) +OWNER( + pg + velavokr +) SRCS( json_writer.cpp diff --git a/library/cpp/json/yson/ut/ya.make b/library/cpp/json/yson/ut/ya.make index f372b26558..4ceb65b279 100644 --- a/library/cpp/json/yson/ut/ya.make +++ b/library/cpp/json/yson/ut/ya.make @@ -7,7 +7,7 @@ UNITTEST_FOR(library/cpp/json/yson) ALLOCATOR(LF) -DATA(sbr://363537653) +DATA(sbr://363537653) PEERDIR( library/cpp/blockcodecs diff --git a/library/cpp/lfalloc/dbg/ya.make b/library/cpp/lfalloc/dbg/ya.make index 41817661a1..3dce653a8c 100644 --- a/library/cpp/lfalloc/dbg/ya.make +++ b/library/cpp/lfalloc/dbg/ya.make @@ -1,9 +1,9 @@ LIBRARY() - + OWNER(vskipin) NO_UTIL() - + NO_COMPILER_WARNINGS() IF (ARCH_AARCH64) @@ -14,10 +14,10 @@ ELSE() IF ("${YMAKE}" MATCHES "devtools") CFLAGS(-DYMAKE=1) ENDIF() - CXXFLAGS( - -DLFALLOC_DBG - -DLFALLOC_YT - ) + CXXFLAGS( + -DLFALLOC_DBG + -DLFALLOC_YT + ) SRCS( ../lf_allocX64.cpp ) diff --git a/library/cpp/lfalloc/dbg_info/ya.make b/library/cpp/lfalloc/dbg_info/ya.make index 6a87d86955..efecba5993 100644 --- a/library/cpp/lfalloc/dbg_info/ya.make +++ b/library/cpp/lfalloc/dbg_info/ya.make @@ -1,5 +1,5 @@ LIBRARY() - + OWNER(vskipin) PEERDIR( diff --git a/library/cpp/lfalloc/ya.make b/library/cpp/lfalloc/ya.make index 932dad551d..cace05f9d8 100644 --- a/library/cpp/lfalloc/ya.make +++ b/library/cpp/lfalloc/ya.make @@ -3,7 +3,7 @@ LIBRARY() OWNER(gulin) NO_UTIL() - + NO_COMPILER_WARNINGS() IF (ARCH_AARCH64) diff --git a/library/cpp/lfalloc/yt/ya.make b/library/cpp/lfalloc/yt/ya.make index 18bccb90ae..8c1a4f8a72 100644 --- a/library/cpp/lfalloc/yt/ya.make +++ b/library/cpp/lfalloc/yt/ya.make @@ -1,9 +1,9 @@ LIBRARY() - + OWNER(a-romanov) NO_UTIL() - + NO_COMPILER_WARNINGS() IF (ARCH_AARCH64) diff --git a/library/cpp/linear_regression/benchmark/ya.make b/library/cpp/linear_regression/benchmark/ya.make index f029ff2348..bbc4f2683a 100644 --- a/library/cpp/linear_regression/benchmark/ya.make +++ b/library/cpp/linear_regression/benchmark/ya.make @@ -1,6 +1,6 @@ PROGRAM(linear_regression_benchmark) -OWNER(alex-sh) +OWNER(alex-sh) SRCS( pool.h diff --git a/library/cpp/linear_regression/ut/ya.make b/library/cpp/linear_regression/ut/ya.make index 32bade0995..f410410673 100644 --- a/library/cpp/linear_regression/ut/ya.make +++ b/library/cpp/linear_regression/ut/ya.make @@ -1,6 +1,6 @@ UNITTEST() -OWNER(alex-sh) +OWNER(alex-sh) PEERDIR( ADDINCL library/cpp/linear_regression diff --git a/library/cpp/linear_regression/ya.make b/library/cpp/linear_regression/ya.make index 6d152c0dd4..4cfcc3d673 100644 --- a/library/cpp/linear_regression/ya.make +++ b/library/cpp/linear_regression/ya.make @@ -1,6 +1,6 @@ LIBRARY() -OWNER(alex-sh) +OWNER(alex-sh) SRCS( linear_regression.cpp diff --git a/library/cpp/malloc/ya.make b/library/cpp/malloc/ya.make index fb846ee3b4..0ec9db71d2 100644 --- a/library/cpp/malloc/ya.make +++ b/library/cpp/malloc/ya.make @@ -23,4 +23,4 @@ IF (NOT OS_WINDOWS) calloc/calloc_profile_scan calloc/calloc_profile_scan/ut ) -ENDIF() +ENDIF() diff --git a/library/cpp/messagebus/remote_connection_status.cpp b/library/cpp/messagebus/remote_connection_status.cpp index 920ff802cd..2c48b2a287 100644 --- a/library/cpp/messagebus/remote_connection_status.cpp +++ b/library/cpp/messagebus/remote_connection_status.cpp @@ -3,7 +3,7 @@ #include "key_value_printer.h" #include <library/cpp/messagebus/monitoring/mon_proto.pb.h> - + #include <util/stream/format.h> #include <util/stream/output.h> #include <util/system/yassert.h> diff --git a/library/cpp/messagebus/test/perftest/perftest.cpp b/library/cpp/messagebus/test/perftest/perftest.cpp index 2b1ff05b3e..8489319278 100644 --- a/library/cpp/messagebus/test/perftest/perftest.cpp +++ b/library/cpp/messagebus/test/perftest/perftest.cpp @@ -1,7 +1,7 @@ #include "simple_proto.h" #include <library/cpp/messagebus/test/perftest/messages.pb.h> - + #include <library/cpp/messagebus/text_utils.h> #include <library/cpp/messagebus/thread_extra.h> #include <library/cpp/messagebus/ybus.h> diff --git a/library/cpp/messagebus/test/ut/ya.make b/library/cpp/messagebus/test/ut/ya.make index 30dae27f89..fe1b4961d6 100644 --- a/library/cpp/messagebus/test/ut/ya.make +++ b/library/cpp/messagebus/test/ut/ya.make @@ -3,14 +3,14 @@ OWNER(g:messagebus) UNITTEST_FOR(library/cpp/messagebus) TIMEOUT(1200) - + SIZE(LARGE) -TAG( - ya:not_autocheck - ya:fat -) - +TAG( + ya:not_autocheck + ya:fat +) + FORK_SUBTESTS() PEERDIR( diff --git a/library/cpp/monlib/deprecated/json/ut/ya.make b/library/cpp/monlib/deprecated/json/ut/ya.make index 36c8baa9d5..18315993b5 100644 --- a/library/cpp/monlib/deprecated/json/ut/ya.make +++ b/library/cpp/monlib/deprecated/json/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/monlib/deprecated/json) -OWNER( - jamel - g:solomon -) +OWNER( + jamel + g:solomon +) SRCS( writer_ut.cpp diff --git a/library/cpp/monlib/deprecated/json/ya.make b/library/cpp/monlib/deprecated/json/ya.make index 5a7914d1c2..0ca903ee62 100644 --- a/library/cpp/monlib/deprecated/json/ya.make +++ b/library/cpp/monlib/deprecated/json/ya.make @@ -7,10 +7,10 @@ LIBRARY() # high level library library/cpp/monlib/encode which is decoupled from the # particular format. -OWNER( - jamel - g:solomon -) +OWNER( + jamel + g:solomon +) SRCS( writer.h diff --git a/library/cpp/monlib/dynamic_counters/ya.make b/library/cpp/monlib/dynamic_counters/ya.make index 975dc81781..aafe1c34be 100644 --- a/library/cpp/monlib/dynamic_counters/ya.make +++ b/library/cpp/monlib/dynamic_counters/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - g:solomon - jamel -) +OWNER( + g:solomon + jamel +) NO_WSHADOW() diff --git a/library/cpp/monlib/encode/buffered/ut/ya.make b/library/cpp/monlib/encode/buffered/ut/ya.make index c81020f5d3..2157ac1490 100644 --- a/library/cpp/monlib/encode/buffered/ut/ya.make +++ b/library/cpp/monlib/encode/buffered/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/monlib/encode/buffered) -OWNER( - g:solomon - jamel -) +OWNER( + g:solomon + jamel +) SRCS( string_pool_ut.cpp diff --git a/library/cpp/monlib/encode/buffered/ya.make b/library/cpp/monlib/encode/buffered/ya.make index 3892cd5455..81b6a78b93 100644 --- a/library/cpp/monlib/encode/buffered/ya.make +++ b/library/cpp/monlib/encode/buffered/ya.make @@ -1,10 +1,10 @@ LIBRARY() -OWNER( - g:solomon - jamel - msherbakov -) +OWNER( + g:solomon + jamel + msherbakov +) SRCS( buffered_encoder_base.cpp diff --git a/library/cpp/monlib/encode/fake/ya.make b/library/cpp/monlib/encode/fake/ya.make index 61ca7b951c..ae96f45782 100644 --- a/library/cpp/monlib/encode/fake/ya.make +++ b/library/cpp/monlib/encode/fake/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - g:solomon - msherbakov -) +OWNER( + g:solomon + msherbakov +) SRCS( fake.cpp diff --git a/library/cpp/monlib/encode/json/fuzz/ya.make b/library/cpp/monlib/encode/json/fuzz/ya.make index 79631841e5..75baa77716 100644 --- a/library/cpp/monlib/encode/json/fuzz/ya.make +++ b/library/cpp/monlib/encode/json/fuzz/ya.make @@ -1,9 +1,9 @@ FUZZ() -OWNER( - g:solomon - msherbakov -) +OWNER( + g:solomon + msherbakov +) PEERDIR( library/cpp/monlib/encode/json @@ -12,8 +12,8 @@ PEERDIR( SIZE(MEDIUM) -SRCS( - main.cpp -) +SRCS( + main.cpp +) END() diff --git a/library/cpp/monlib/encode/json/ut/ya.make b/library/cpp/monlib/encode/json/ut/ya.make index 841ae044ba..e50c4f4903 100644 --- a/library/cpp/monlib/encode/json/ut/ya.make +++ b/library/cpp/monlib/encode/json/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/monlib/encode/json) -OWNER( - g:solomon - jamel -) +OWNER( + g:solomon + jamel +) SRCS( json_decoder_ut.cpp diff --git a/library/cpp/monlib/encode/json/ya.make b/library/cpp/monlib/encode/json/ya.make index 7bbeab83bc..a50fc412a9 100644 --- a/library/cpp/monlib/encode/json/ya.make +++ b/library/cpp/monlib/encode/json/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - g:solomon - jamel -) +OWNER( + g:solomon + jamel +) SRCS( json_decoder.cpp diff --git a/library/cpp/monlib/encode/legacy_protobuf/ut/ya.make b/library/cpp/monlib/encode/legacy_protobuf/ut/ya.make index f06592f7c6..479a0c46c9 100644 --- a/library/cpp/monlib/encode/legacy_protobuf/ut/ya.make +++ b/library/cpp/monlib/encode/legacy_protobuf/ut/ya.make @@ -1,18 +1,18 @@ UNITTEST_FOR(library/cpp/monlib/encode/legacy_protobuf) -OWNER( - g:solomon - msherbakov -) +OWNER( + g:solomon + msherbakov +) SRCS( legacy_protobuf_ut.cpp test_cases.proto ) -PEERDIR( +PEERDIR( library/cpp/monlib/encode/protobuf library/cpp/monlib/encode/text -) +) END() diff --git a/library/cpp/monlib/encode/legacy_protobuf/ya.make b/library/cpp/monlib/encode/legacy_protobuf/ya.make index ce6253fdd9..74c82aac93 100644 --- a/library/cpp/monlib/encode/legacy_protobuf/ya.make +++ b/library/cpp/monlib/encode/legacy_protobuf/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - g:solomon - msherbakov -) +OWNER( + g:solomon + msherbakov +) SRCS( legacy_proto_decoder.cpp diff --git a/library/cpp/monlib/encode/protobuf/protos/ya.make b/library/cpp/monlib/encode/protobuf/protos/ya.make index 724cf3168b..88ff3ddf88 100644 --- a/library/cpp/monlib/encode/protobuf/protos/ya.make +++ b/library/cpp/monlib/encode/protobuf/protos/ya.make @@ -1,9 +1,9 @@ PROTO_LIBRARY() -OWNER( - jamel - g:solomon -) +OWNER( + jamel + g:solomon +) SRCS( samples.proto diff --git a/library/cpp/monlib/encode/protobuf/ya.make b/library/cpp/monlib/encode/protobuf/ya.make index 0cdab38a6a..9354958b6f 100644 --- a/library/cpp/monlib/encode/protobuf/ya.make +++ b/library/cpp/monlib/encode/protobuf/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - jamel - g:solomon -) +OWNER( + jamel + g:solomon +) SRCS( protobuf_encoder.cpp diff --git a/library/cpp/monlib/encode/spack/fuzz/ya.make b/library/cpp/monlib/encode/spack/fuzz/ya.make index f94adf967c..99b63eadd5 100644 --- a/library/cpp/monlib/encode/spack/fuzz/ya.make +++ b/library/cpp/monlib/encode/spack/fuzz/ya.make @@ -1,12 +1,12 @@ FUZZ() -OWNER( - g:solomon - msherbakov +OWNER( + g:solomon + msherbakov ) -FUZZ_OPTS(-rss_limit_mb=1024) - +FUZZ_OPTS(-rss_limit_mb=1024) + SIZE(MEDIUM) PEERDIR( @@ -14,8 +14,8 @@ PEERDIR( library/cpp/monlib/encode/fake ) -SRCS( - main.cpp -) +SRCS( + main.cpp +) END() diff --git a/library/cpp/monlib/encode/spack/ut/ya.make b/library/cpp/monlib/encode/spack/ut/ya.make index ab09999c2d..980bf54667 100644 --- a/library/cpp/monlib/encode/spack/ut/ya.make +++ b/library/cpp/monlib/encode/spack/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/monlib/encode/spack) -OWNER( - g:solomon - jamel -) +OWNER( + g:solomon + jamel +) SRCS( spack_v1_ut.cpp diff --git a/library/cpp/monlib/encode/spack/ya.make b/library/cpp/monlib/encode/spack/ya.make index 2de5771477..78d3061291 100644 --- a/library/cpp/monlib/encode/spack/ya.make +++ b/library/cpp/monlib/encode/spack/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - g:solomon - jamel -) +OWNER( + g:solomon + jamel +) SRCS( spack_v1_decoder.cpp diff --git a/library/cpp/monlib/encode/text/ut/ya.make b/library/cpp/monlib/encode/text/ut/ya.make index 49124cf977..df23a252d1 100644 --- a/library/cpp/monlib/encode/text/ut/ya.make +++ b/library/cpp/monlib/encode/text/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/monlib/encode/text) -OWNER( - g:solomon - jamel -) +OWNER( + g:solomon + jamel +) SRCS( text_encoder_ut.cpp diff --git a/library/cpp/monlib/encode/text/ya.make b/library/cpp/monlib/encode/text/ya.make index c0a51d4126..d296c78c1b 100644 --- a/library/cpp/monlib/encode/text/ya.make +++ b/library/cpp/monlib/encode/text/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - g:solomon - jamel -) +OWNER( + g:solomon + jamel +) SRCS( text_encoder.cpp diff --git a/library/cpp/monlib/encode/ut/ya.make b/library/cpp/monlib/encode/ut/ya.make index 57c474e9ac..1990386d76 100644 --- a/library/cpp/monlib/encode/ut/ya.make +++ b/library/cpp/monlib/encode/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/monlib/encode) -OWNER( - jamel - g:solomon -) +OWNER( + jamel + g:solomon +) SRCS( format_ut.cpp diff --git a/library/cpp/monlib/encode/ya.make b/library/cpp/monlib/encode/ya.make index 0eecb4feb3..d1bb09f07b 100644 --- a/library/cpp/monlib/encode/ya.make +++ b/library/cpp/monlib/encode/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - g:solomon - jamel -) +OWNER( + g:solomon + jamel +) SRCS( encoder.cpp diff --git a/library/cpp/monlib/metrics/ut/ya.make b/library/cpp/monlib/metrics/ut/ya.make index 267e6a3bdf..aec9974fbd 100644 --- a/library/cpp/monlib/metrics/ut/ya.make +++ b/library/cpp/monlib/metrics/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/monlib/metrics) -OWNER( - jamel - g:solomon -) +OWNER( + jamel + g:solomon +) SRCS( ewma_ut.cpp diff --git a/library/cpp/monlib/metrics/ya.make b/library/cpp/monlib/metrics/ya.make index d2c51ec443..0e1fa143f9 100644 --- a/library/cpp/monlib/metrics/ya.make +++ b/library/cpp/monlib/metrics/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - g:solomon - jamel -) +OWNER( + g:solomon + jamel +) GENERATE_ENUM_SERIALIZATION_WITH_HEADER(metric_value_type.h) diff --git a/library/cpp/monlib/ya.make b/library/cpp/monlib/ya.make index fc6b4bcef2..9bd236d6fd 100644 --- a/library/cpp/monlib/ya.make +++ b/library/cpp/monlib/ya.make @@ -1,7 +1,7 @@ -OWNER( - g:solomon - jamel -) +OWNER( + g:solomon + jamel +) RECURSE( consumers diff --git a/library/cpp/openssl/io/ut/ya.make b/library/cpp/openssl/io/ut/ya.make index de5fedcb05..b978a6c046 100644 --- a/library/cpp/openssl/io/ut/ya.make +++ b/library/cpp/openssl/io/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/openssl/io) -OWNER( - pg - cerevra -) +OWNER( + pg + cerevra +) SRCS( builtin_ut.cpp diff --git a/library/cpp/protobuf/json/ut/inline_ut.cpp b/library/cpp/protobuf/json/ut/inline_ut.cpp index 3a867c35b4..c29ad32e7d 100644 --- a/library/cpp/protobuf/json/ut/inline_ut.cpp +++ b/library/cpp/protobuf/json/ut/inline_ut.cpp @@ -1,5 +1,5 @@ #include <library/cpp/protobuf/json/ut/inline_ut.pb.h> - + #include <library/cpp/protobuf/json/inline.h> #include <library/cpp/protobuf/json/field_option.h> #include <library/cpp/protobuf/json/proto2json.h> diff --git a/library/cpp/protobuf/json/ut/json2proto_ut.cpp b/library/cpp/protobuf/json/ut/json2proto_ut.cpp index b5c7409487..0dfe57bc7a 100644 --- a/library/cpp/protobuf/json/ut/json2proto_ut.cpp +++ b/library/cpp/protobuf/json/ut/json2proto_ut.cpp @@ -3,7 +3,7 @@ #include "proto2json.h" #include <library/cpp/protobuf/json/ut/test.pb.h> - + #include <library/cpp/json/json_value.h> #include <library/cpp/json/json_reader.h> #include <library/cpp/json/json_writer.h> diff --git a/library/cpp/protobuf/json/ut/proto2json_ut.cpp b/library/cpp/protobuf/json/ut/proto2json_ut.cpp index 04ee4389ee..07e52d7f2f 100644 --- a/library/cpp/protobuf/json/ut/proto2json_ut.cpp +++ b/library/cpp/protobuf/json/ut/proto2json_ut.cpp @@ -2,7 +2,7 @@ #include "proto.h" #include <library/cpp/protobuf/json/ut/test.pb.h> - + #include <library/cpp/json/json_value.h> #include <library/cpp/json/json_reader.h> #include <library/cpp/json/json_writer.h> diff --git a/library/cpp/protobuf/json/ut/ya.make b/library/cpp/protobuf/json/ut/ya.make index 649f4c56a5..b60a6d3c17 100644 --- a/library/cpp/protobuf/json/ut/ya.make +++ b/library/cpp/protobuf/json/ut/ya.make @@ -16,8 +16,8 @@ SRCS( GENERATE_ENUM_SERIALIZATION(test.pb.h) -PEERDIR( +PEERDIR( library/cpp/protobuf/json -) +) END() diff --git a/library/cpp/random_provider/ya.make b/library/cpp/random_provider/ya.make index 2104e81b6e..38d1f070e8 100644 --- a/library/cpp/random_provider/ya.make +++ b/library/cpp/random_provider/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - g:kikimr - g:yql -) +OWNER( + g:kikimr + g:yql +) SRCS( random_provider.cpp diff --git a/library/cpp/regex/hyperscan/ut/ya.make b/library/cpp/regex/hyperscan/ut/ya.make index cf0378f4b3..da67b88672 100644 --- a/library/cpp/regex/hyperscan/ut/ya.make +++ b/library/cpp/regex/hyperscan/ut/ya.make @@ -4,7 +4,7 @@ PEERDIR( library/cpp/regex/hyperscan ) -OWNER(g:antiinfra) +OWNER(g:antiinfra) SRCS( hyperscan_ut.cpp diff --git a/library/cpp/regex/hyperscan/ya.make b/library/cpp/regex/hyperscan/ya.make index cf14c98ea3..e99130ae18 100644 --- a/library/cpp/regex/hyperscan/ya.make +++ b/library/cpp/regex/hyperscan/ya.make @@ -1,6 +1,6 @@ LIBRARY() -OWNER(g:antiinfra) +OWNER(g:antiinfra) PEERDIR( contrib/libs/hyperscan diff --git a/library/cpp/regex/pire/inline/ya.make b/library/cpp/regex/pire/inline/ya.make index a922cca871..d4850f7b45 100644 --- a/library/cpp/regex/pire/inline/ya.make +++ b/library/cpp/regex/pire/inline/ya.make @@ -2,18 +2,18 @@ PROGRAM(pire_inline) CFLAGS(-DPIRE_NO_CONFIG) -OWNER( - g:util - davenger -) +OWNER( + g:util + davenger +) PEERDIR( ADDINCL library/cpp/regex/pire ) -SRCDIR( - contrib/libs/pire/pire -) +SRCDIR( + contrib/libs/pire/pire +) SRCS( inline.l diff --git a/library/cpp/regex/pire/ut/ya.make b/library/cpp/regex/pire/ut/ya.make index 97adb509b4..8776695f40 100644 --- a/library/cpp/regex/pire/ut/ya.make +++ b/library/cpp/regex/pire/ut/ya.make @@ -2,10 +2,10 @@ UNITTEST() -OWNER( - g:util - davenger -) +OWNER( + g:util + davenger +) SET(PIRETESTSDIR contrib/libs/pire/ut) diff --git a/library/cpp/regex/pire/ya.make b/library/cpp/regex/pire/ya.make index c36fef6454..c857e6d18b 100644 --- a/library/cpp/regex/pire/ya.make +++ b/library/cpp/regex/pire/ya.make @@ -1,15 +1,15 @@ LIBRARY() -OWNER( - g:util - g:antiinfra - davenger - pg -) +OWNER( + g:util + g:antiinfra + davenger + pg +) CFLAGS(-DPIRE_NO_CONFIG) -SRCDIR(contrib/libs/pire/pire) +SRCDIR(contrib/libs/pire/pire) SRCS( pcre2pire.cpp diff --git a/library/cpp/retry/ut/ya.make b/library/cpp/retry/ut/ya.make index ec46544bc6..ff8259bfdb 100644 --- a/library/cpp/retry/ut/ya.make +++ b/library/cpp/retry/ut/ya.make @@ -1,10 +1,10 @@ UNITTEST_FOR(library/cpp/retry) -OWNER( - salmin - osado - g:yabs-small -) +OWNER( + salmin + osado + g:yabs-small +) SRCS( retry_ut.cpp diff --git a/library/cpp/retry/ya.make b/library/cpp/retry/ya.make index 66906ca5e8..31e0c6a259 100644 --- a/library/cpp/retry/ya.make +++ b/library/cpp/retry/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - osado - g:yabs-small -) +OWNER( + osado + g:yabs-small +) SRCS( retry.cpp diff --git a/library/cpp/scheme/ya.make b/library/cpp/scheme/ya.make index e23eb90c5e..bac08ba5a4 100644 --- a/library/cpp/scheme/ya.make +++ b/library/cpp/scheme/ya.make @@ -20,6 +20,6 @@ PEERDIR( library/cpp/string_utils/relaxed_escaper ) -GENERATE_ENUM_SERIALIZATION(scheme.h) +GENERATE_ENUM_SERIALIZATION(scheme.h) END() diff --git a/library/cpp/streams/brotli/ut/ya.make b/library/cpp/streams/brotli/ut/ya.make index d78b53a86f..243462f1b2 100644 --- a/library/cpp/streams/brotli/ut/ya.make +++ b/library/cpp/streams/brotli/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/streams/brotli) -OWNER( - levysotsky - g:util -) +OWNER( + levysotsky + g:util +) SRCS( brotli_ut.cpp diff --git a/library/cpp/streams/brotli/ya.make b/library/cpp/streams/brotli/ya.make index ac0c06b544..fa2bfec9cc 100644 --- a/library/cpp/streams/brotli/ya.make +++ b/library/cpp/streams/brotli/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - levysotsky - g:util -) +OWNER( + levysotsky + g:util +) PEERDIR( contrib/libs/brotli/enc diff --git a/library/cpp/streams/bzip2/ut/ya.make b/library/cpp/streams/bzip2/ut/ya.make index 15643501f5..5ef91498ca 100644 --- a/library/cpp/streams/bzip2/ut/ya.make +++ b/library/cpp/streams/bzip2/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/streams/bzip2) -OWNER( - pg - g:util -) +OWNER( + pg + g:util +) SRCS( bzip2_ut.cpp diff --git a/library/cpp/streams/bzip2/ya.make b/library/cpp/streams/bzip2/ya.make index 9e140d618b..122a35837c 100644 --- a/library/cpp/streams/bzip2/ya.make +++ b/library/cpp/streams/bzip2/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - pg - g:util -) +OWNER( + pg + g:util +) PEERDIR( contrib/libs/libbz2 diff --git a/library/cpp/streams/lz/ut/ya.make b/library/cpp/streams/lz/ut/ya.make index 1fdb6708af..18288c8ac9 100644 --- a/library/cpp/streams/lz/ut/ya.make +++ b/library/cpp/streams/lz/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/streams/lz) -OWNER( - pg - g:util -) +OWNER( + pg + g:util +) RESOURCE( random.data /random.data diff --git a/library/cpp/streams/lz/ya.make b/library/cpp/streams/lz/ya.make index f178a45385..e5eea0b096 100644 --- a/library/cpp/streams/lz/ya.make +++ b/library/cpp/streams/lz/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - pg - g:util -) +OWNER( + pg + g:util +) PEERDIR( contrib/libs/fastlz diff --git a/library/cpp/streams/zc_memory_input/ya.make b/library/cpp/streams/zc_memory_input/ya.make index 2e4138acc4..bc94d6f1ed 100644 --- a/library/cpp/streams/zc_memory_input/ya.make +++ b/library/cpp/streams/zc_memory_input/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - pg - g:util -) +OWNER( + pg + g:util +) SRCS( zc_memory_input.cpp diff --git a/library/cpp/string_utils/base64/bench/metrics/ya.make b/library/cpp/string_utils/base64/bench/metrics/ya.make index 579ca453ac..b0406516c3 100644 --- a/library/cpp/string_utils/base64/bench/metrics/ya.make +++ b/library/cpp/string_utils/base64/bench/metrics/ya.make @@ -13,7 +13,7 @@ TAG( ya:fat ) -TEST_SRCS(main.py) +TEST_SRCS(main.py) DEPENDS(library/cpp/string_utils/base64/bench) diff --git a/library/cpp/string_utils/levenshtein_diff/ut/ya.make b/library/cpp/string_utils/levenshtein_diff/ut/ya.make index f4cd2d8319..a3b9b8fea5 100644 --- a/library/cpp/string_utils/levenshtein_diff/ut/ya.make +++ b/library/cpp/string_utils/levenshtein_diff/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/string_utils/levenshtein_diff) - + OWNER(myltsev) -SRCS( +SRCS( levenshtein_diff_ut.cpp -) +) END() diff --git a/library/cpp/testing/benchmark/examples/metrics/ya.make b/library/cpp/testing/benchmark/examples/metrics/ya.make index 3d59b660b0..a9dbdca9fa 100644 --- a/library/cpp/testing/benchmark/examples/metrics/ya.make +++ b/library/cpp/testing/benchmark/examples/metrics/ya.make @@ -13,7 +13,7 @@ TAG( ya:fat ) -TEST_SRCS(main.py) +TEST_SRCS(main.py) DEPENDS(library/cpp/testing/benchmark/examples) diff --git a/library/cpp/testing/benchmark/main/ya.make b/library/cpp/testing/benchmark/main/ya.make index 0cf231bee2..d00cdcf9fc 100644 --- a/library/cpp/testing/benchmark/main/ya.make +++ b/library/cpp/testing/benchmark/main/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - pg - yazevnul -) +OWNER( + pg + yazevnul +) SRCS( GLOBAL main.cpp diff --git a/library/cpp/testing/benchmark/ya.make b/library/cpp/testing/benchmark/ya.make index 16bc28837d..f42be80698 100644 --- a/library/cpp/testing/benchmark/ya.make +++ b/library/cpp/testing/benchmark/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - pg - yazevnul -) +OWNER( + pg + yazevnul +) SRCS( bench.cpp diff --git a/library/cpp/testing/unittest/fat/ya.make b/library/cpp/testing/unittest/fat/ya.make index 10846454de..d405e599ee 100644 --- a/library/cpp/testing/unittest/fat/ya.make +++ b/library/cpp/testing/unittest/fat/ya.make @@ -11,9 +11,9 @@ SIZE(LARGE) # We need to run tests at the same time on the single machine FORK_SUBTESTS() -TAG( - ya:fat - ya:force_sandbox -) - +TAG( + ya:fat + ya:force_sandbox +) + END() diff --git a/library/cpp/threading/future/perf/ya.make b/library/cpp/threading/future/perf/ya.make index a3cfbfb0c7..943d585d4b 100644 --- a/library/cpp/threading/future/perf/ya.make +++ b/library/cpp/threading/future/perf/ya.make @@ -1,9 +1,9 @@ Y_BENCHMARK(library-threading-future-perf) -OWNER( - g:rtmr - ishfb -) +OWNER( + g:rtmr + ishfb +) SRCS( main.cpp diff --git a/library/cpp/threading/future/ut/ya.make b/library/cpp/threading/future/ut/ya.make index 9de072c5cf..566b622370 100644 --- a/library/cpp/threading/future/ut/ya.make +++ b/library/cpp/threading/future/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/threading/future) -OWNER( - g:rtmr - ishfb -) +OWNER( + g:rtmr + ishfb +) SRCS( async_ut.cpp diff --git a/library/cpp/threading/light_rw_lock/ut/ya.make b/library/cpp/threading/light_rw_lock/ut/ya.make index a75dd6d5eb..92928b837c 100644 --- a/library/cpp/threading/light_rw_lock/ut/ya.make +++ b/library/cpp/threading/light_rw_lock/ut/ya.make @@ -1,6 +1,6 @@ UNITTEST_FOR(library/cpp/threading/light_rw_lock) -OWNER(agri) +OWNER(agri) SRCS( rwlock_ut.cpp diff --git a/library/cpp/threading/poor_man_openmp/ut/ya.make b/library/cpp/threading/poor_man_openmp/ut/ya.make index 57f21db4f0..6d7aa123ed 100644 --- a/library/cpp/threading/poor_man_openmp/ut/ya.make +++ b/library/cpp/threading/poor_man_openmp/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/threading/poor_man_openmp) -OWNER( - pg - agorodilov -) +OWNER( + pg + agorodilov +) SRCS( thread_helper_ut.cpp diff --git a/library/cpp/threading/queue/ut/ya.make b/library/cpp/threading/queue/ut/ya.make index 1798215c5a..8883d9bf69 100644 --- a/library/cpp/threading/queue/ut/ya.make +++ b/library/cpp/threading/queue/ut/ya.make @@ -1,6 +1,6 @@ UNITTEST_FOR(library/cpp/threading/queue) -OWNER(agri) +OWNER(agri) ALLOCATOR(B) diff --git a/library/cpp/time_provider/ya.make b/library/cpp/time_provider/ya.make index 1e59682bb1..cf3995b2a4 100644 --- a/library/cpp/time_provider/ya.make +++ b/library/cpp/time_provider/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - g:kikimr - g:yql -) +OWNER( + g:kikimr + g:yql +) SRCS( time_provider.cpp diff --git a/library/cpp/timezone_conversion/ya.make b/library/cpp/timezone_conversion/ya.make index 8de5ed17a9..f99ebe73ee 100644 --- a/library/cpp/timezone_conversion/ya.make +++ b/library/cpp/timezone_conversion/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - dfyz - petrk -) +OWNER( + dfyz + petrk +) PEERDIR( contrib/libs/cctz/tzdata diff --git a/library/cpp/tld/ya.make b/library/cpp/tld/ya.make index 7b36e6b0eb..aeabbfeebf 100644 --- a/library/cpp/tld/ya.make +++ b/library/cpp/tld/ya.make @@ -3,10 +3,10 @@ LIBRARY() OWNER(abolkhovityanov) PYTHON( - gen_tld.py tlds-alpha-by-domain.txt - IN tlds-alpha-by-domain.txt - STDOUT tld.inc -) + gen_tld.py tlds-alpha-by-domain.txt + IN tlds-alpha-by-domain.txt + STDOUT tld.inc +) SRCS( tld.cpp diff --git a/library/cpp/tvmauth/src/rw/ut_large/ya.make b/library/cpp/tvmauth/src/rw/ut_large/ya.make index f33e33a786..54f82065e7 100644 --- a/library/cpp/tvmauth/src/rw/ut_large/ya.make +++ b/library/cpp/tvmauth/src/rw/ut_large/ya.make @@ -2,16 +2,16 @@ PY2TEST() OWNER(g:passport_infra) -TEST_SRCS(test.py) +TEST_SRCS(test.py) DEPENDS(library/cpp/tvmauth/src/rw/ut_large/gen) TAG(ya:fat) - + SIZE(LARGE) END() -RECURSE( - gen -) +RECURSE( + gen +) diff --git a/library/cpp/unicode/normalization/generated/decomposition.cpp b/library/cpp/unicode/normalization/generated/decomposition.cpp index 2d6cf6583b..9ac6a5f92a 100644 --- a/library/cpp/unicode/normalization/generated/decomposition.cpp +++ b/library/cpp/unicode/normalization/generated/decomposition.cpp @@ -42207,7 +42207,7 @@ namespace { namespace NCannonDecompositionTableGenerated { }, // P[475] }; // static const NUnicode::NPrivate::TDecompositionTable::TValuePtr P[][32] - static const NUnicode::NPrivate::TDecompositionTable::TValuePtr* const Indexes[] = { + static const NUnicode::NPrivate::TDecompositionTable::TValuePtr* const Indexes[] = { P[0], P[0], P[0], P[0], P[0], P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[0], P[7], P[8], P[9], P[10], P[11], P[0], P[0], P[0], P[0], P[0], P[0], P[0], P[0], P[12], P[13], P[14], P[15], P[16], P[0], P[17], P[18], P[19], P[20], P[0], P[0], P[21], P[22], P[0], P[0], P[0], P[0], P[0], P[0], P[0], P[0], @@ -42590,7 +42590,7 @@ namespace { namespace NCannonDecompositionTableGenerated { P[0], P[0], P[0], P[0], P[0], P[0], P[0], P[0], P[0], P[0], P[0], P[0], P[0], P[0], P[0], P[0], P[459], P[460], P[461], P[462], P[463], P[464], P[465], P[466], P[467], P[468], P[469], P[470], P[471], P[472], P[473], P[474], P[475], - }; // static const NUnicode::NPrivate::TDecompositionTable::TValuePtr* const Indexes[] + }; // static const NUnicode::NPrivate::TDecompositionTable::TValuePtr* const Indexes[] static const size_t Size = 195102; }} // namespace NCannonDecompositionTableGenerated @@ -90733,7 +90733,7 @@ namespace { namespace NCompatDecompositionTableGenerated { }, // P[623] }; // static const NUnicode::NPrivate::TDecompositionTable::TValuePtr P[][32] - static const NUnicode::NPrivate::TDecompositionTable::TValuePtr* const Indexes[] = { + static const NUnicode::NPrivate::TDecompositionTable::TValuePtr* const Indexes[] = { P[0], P[0], P[0], P[0], P[0], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[0], P[8], P[9], P[10], P[11], P[12], P[0], P[0], P[0], P[13], P[14], P[15], P[0], P[0], P[16], P[17], P[18], P[19], P[20], P[21], P[22], P[23], P[24], P[25], P[0], P[0], P[26], P[27], P[0], P[0], P[0], P[0], P[28], P[0], P[0], P[0], @@ -91116,7 +91116,7 @@ namespace { namespace NCompatDecompositionTableGenerated { P[0], P[0], P[0], P[0], P[0], P[0], P[0], P[0], P[0], P[0], P[0], P[0], P[0], P[0], P[0], P[0], P[607], P[608], P[609], P[610], P[611], P[612], P[613], P[614], P[615], P[616], P[617], P[618], P[619], P[620], P[621], P[622], P[623], - }; // static const NUnicode::NPrivate::TDecompositionTable::TValuePtr* const Indexes[] + }; // static const NUnicode::NPrivate::TDecompositionTable::TValuePtr* const Indexes[] static const size_t Size = 195102; }} // namespace NCompatDecompositionTableGenerated diff --git a/library/cpp/unicode/ya.make b/library/cpp/unicode/ya.make index 048d69b297..4fcd9caacc 100644 --- a/library/cpp/unicode/ya.make +++ b/library/cpp/unicode/ya.make @@ -5,8 +5,8 @@ RECURSE( normalization/ut punycode punycode/ut - set - set/ut + set + set/ut utf8_char utf8_char/ut utf8_iter diff --git a/library/cpp/uri/ut/ya.make b/library/cpp/uri/ut/ya.make index af67f59197..b2b2c1291a 100644 --- a/library/cpp/uri/ut/ya.make +++ b/library/cpp/uri/ut/ya.make @@ -3,7 +3,7 @@ UNITTEST_FOR(library/cpp/uri) OWNER(leo) NO_OPTIMIZE() - + NO_WSHADOW() PEERDIR( diff --git a/library/cpp/yson_pull/ya.make b/library/cpp/yson_pull/ya.make index 7a384eed29..a373e0a6ba 100644 --- a/library/cpp/yson_pull/ya.make +++ b/library/cpp/yson_pull/ya.make @@ -15,7 +15,7 @@ SRCS( ) GENERATE_ENUM_SERIALIZATION(event.h) - + GENERATE_ENUM_SERIALIZATION(scalar.h) END() diff --git a/library/python/cores/ya.make b/library/python/cores/ya.make index 58463feb7e..76264e9cce 100644 --- a/library/python/cores/ya.make +++ b/library/python/cores/ya.make @@ -5,7 +5,7 @@ OWNER( PY23_LIBRARY() -PY_SRCS(__init__.py) +PY_SRCS(__init__.py) PEERDIR( contrib/python/six diff --git a/library/python/filelock/__init__.py b/library/python/filelock/__init__.py index cdf2ee4f68..f81ff67f37 100644 --- a/library/python/filelock/__init__.py +++ b/library/python/filelock/__init__.py @@ -1,12 +1,12 @@ -import errno -import logging -import os +import errno +import logging +import os import sys import library.python.windows logger = logging.getLogger(__name__) - + def set_close_on_exec(stream): if library.python.windows.on_win(): @@ -74,19 +74,19 @@ class _WinFileLock(AbstractFileLock): def __init__(self, path): super(_WinFileLock, self).__init__(path) self._lock = None - try: - with file(path, 'w') as lock_file: - lock_file.write(" " * self._LOCKED_BYTES_NUM) - except IOError as e: - if e.errno != errno.EACCES or not os.path.isfile(path): - raise + try: + with file(path, 'w') as lock_file: + lock_file.write(" " * self._LOCKED_BYTES_NUM) + except IOError as e: + if e.errno != errno.EACCES or not os.path.isfile(path): + raise def acquire(self, blocking=True): self._lock = open(self.path) set_close_on_exec(self._lock) import time - locked = False + locked = False while not locked: locked = library.python.windows.lock_file(self._lock, 0, self._LOCKED_BYTES_NUM, raises=False) if locked: @@ -97,7 +97,7 @@ class _WinFileLock(AbstractFileLock): return False def release(self): - if self._lock: + if self._lock: library.python.windows.unlock_file(self._lock, 0, self._LOCKED_BYTES_NUM, raises=False) self._lock.close() self._lock = None diff --git a/library/python/filelock/ut/lib/test_filelock.py b/library/python/filelock/ut/lib/test_filelock.py index 5c2e0181ff..1b11d89123 100644 --- a/library/python/filelock/ut/lib/test_filelock.py +++ b/library/python/filelock/ut/lib/test_filelock.py @@ -8,13 +8,13 @@ import threading import library.python.filelock -def _acquire_lock(lock_path, out_file_path): +def _acquire_lock(lock_path, out_file_path): with library.python.filelock.FileLock(lock_path): - with open(out_file_path, "a") as out: - out.write("{}:{}\n".format(os.getpid(), time.time())) - time.sleep(2) - - + with open(out_file_path, "a") as out: + out.write("{}:{}\n".format(os.getpid(), time.time())) + time.sleep(2) + + def test_filelock(): temp_dir = tempfile.mkdtemp() lock_path = os.path.join(temp_dir, "file.lock") @@ -46,12 +46,12 @@ def test_filelock(): time2 = times.pop() assert int(time1) - int(time2) >= 2 time1 = time2 - - + + def test_filelock_init_acquired(): temp_dir = tempfile.mkdtemp() lock_path = os.path.join(temp_dir, "file.lock") - + with library.python.filelock.FileLock(lock_path): sublock = library.python.filelock.FileLock(lock_path) del sublock diff --git a/library/python/filelock/ut/lib/ya.make b/library/python/filelock/ut/lib/ya.make index 291f8a32ba..f3f9da5a67 100644 --- a/library/python/filelock/ut/lib/ya.make +++ b/library/python/filelock/ut/lib/ya.make @@ -2,7 +2,7 @@ OWNER(g:yatool) PY23_LIBRARY() -TEST_SRCS(test_filelock.py) +TEST_SRCS(test_filelock.py) PEERDIR( library/python/filelock diff --git a/library/python/filelock/ya.make b/library/python/filelock/ya.make index d67540b8f7..958cc1866f 100644 --- a/library/python/filelock/ya.make +++ b/library/python/filelock/ya.make @@ -4,8 +4,8 @@ PY23_LIBRARY() PY_SRCS(__init__.py) -PEERDIR( - library/python/windows -) +PEERDIR( + library/python/windows +) END() diff --git a/library/python/find_root/ya.make b/library/python/find_root/ya.make index 1f22e4a5f8..beaa8e3c52 100644 --- a/library/python/find_root/ya.make +++ b/library/python/find_root/ya.make @@ -2,6 +2,6 @@ PY23_LIBRARY() OWNER(g:yatool) -PY_SRCS(__init__.py) +PY_SRCS(__init__.py) END() diff --git a/library/python/fs/__init__.py b/library/python/fs/__init__.py index 2bc368f43f..b1b7cde079 100644 --- a/library/python/fs/__init__.py +++ b/library/python/fs/__init__.py @@ -1,13 +1,13 @@ # coding: utf-8 -import codecs +import codecs import errno import logging import os import random import shutil import six -import stat +import stat import sys import library.python.func @@ -23,179 +23,179 @@ except NameError: WindowsError = None -_diehard_win_tries = 10 +_diehard_win_tries = 10 errorfix_win = library.python.windows.errorfix - - -class CustomFsError(OSError): - def __init__(self, errno, message='', filename=None): - super(CustomFsError, self).__init__(message) - self.errno = errno - self.strerror = os.strerror(errno) - self.filename = filename - - -# Directories creation -# If dst is already exists and is a directory - does nothing -# Throws OSError -@errorfix_win -def ensure_dir(path): + + +class CustomFsError(OSError): + def __init__(self, errno, message='', filename=None): + super(CustomFsError, self).__init__(message) + self.errno = errno + self.strerror = os.strerror(errno) + self.filename = filename + + +# Directories creation +# If dst is already exists and is a directory - does nothing +# Throws OSError +@errorfix_win +def ensure_dir(path): try: os.makedirs(path) except OSError as e: - if e.errno != errno.EEXIST or not os.path.isdir(path): + if e.errno != errno.EEXIST or not os.path.isdir(path): raise - -# Directories creation -# If dst is already exists and is a directory - does nothing -# Returns path -# Throws OSError -@errorfix_win -def create_dirs(path): - ensure_dir(path) + +# Directories creation +# If dst is already exists and is a directory - does nothing +# Returns path +# Throws OSError +@errorfix_win +def create_dirs(path): + ensure_dir(path) return path -# Atomic file/directory move (rename) -# Doesn't guarantee dst replacement -# Atomic if no device boundaries are crossed -# Depends on ctypes on Windows -# Throws OSError -# On Unix, if dst exists: -# if dst is file or empty dir - replaces it -# if src is dir and dst is not dir - throws OSError (errno ENOTDIR) -# if src is dir and dst is non-empty dir - throws OSError (errno ENOTEMPTY) -# if src is file and dst is dir - throws OSError (errno EISDIR) -# On Windows, if dst exists - throws OSError (errno EEXIST) -@errorfix_win +# Atomic file/directory move (rename) +# Doesn't guarantee dst replacement +# Atomic if no device boundaries are crossed +# Depends on ctypes on Windows +# Throws OSError +# On Unix, if dst exists: +# if dst is file or empty dir - replaces it +# if src is dir and dst is not dir - throws OSError (errno ENOTDIR) +# if src is dir and dst is non-empty dir - throws OSError (errno ENOTEMPTY) +# if src is file and dst is dir - throws OSError (errno EISDIR) +# On Windows, if dst exists - throws OSError (errno EEXIST) +@errorfix_win @library.python.windows.diehard(library.python.windows.RETRIABLE_FILE_ERRORS, tries=_diehard_win_tries) -def move(src, dst): - os.rename(src, dst) - - -# Atomic replacing file move (rename) -# Replaces dst if exists and not a dir -# Doesn't guarantee dst dir replacement -# Atomic if no device boundaries are crossed -# Depends on ctypes on Windows -# Throws OSError -# On Unix, if dst exists: -# if dst is file - replaces it -# if dst is dir - throws OSError (errno EISDIR) -# On Windows, if dst exists: -# if dst is file - replaces it -# if dst is dir - throws OSError (errno EACCES) -@errorfix_win +def move(src, dst): + os.rename(src, dst) + + +# Atomic replacing file move (rename) +# Replaces dst if exists and not a dir +# Doesn't guarantee dst dir replacement +# Atomic if no device boundaries are crossed +# Depends on ctypes on Windows +# Throws OSError +# On Unix, if dst exists: +# if dst is file - replaces it +# if dst is dir - throws OSError (errno EISDIR) +# On Windows, if dst exists: +# if dst is file - replaces it +# if dst is dir - throws OSError (errno EACCES) +@errorfix_win @library.python.windows.diehard(library.python.windows.RETRIABLE_FILE_ERRORS, tries=_diehard_win_tries) -def replace_file(src, dst): +def replace_file(src, dst): if library.python.windows.on_win(): library.python.windows.replace_file(src, dst) - else: - os.rename(src, dst) - - -# File/directory replacing move (rename) -# Removes dst if exists -# Non-atomic -# Depends on ctypes on Windows -# Throws OSError -@errorfix_win -def replace(src, dst): - try: - move(src, dst) - except OSError as e: - if e.errno not in (errno.EEXIST, errno.EISDIR, errno.ENOTDIR, errno.ENOTEMPTY): - raise - remove_tree(dst) - move(src, dst) - - -# Atomic file remove -# Throws OSError -@errorfix_win + else: + os.rename(src, dst) + + +# File/directory replacing move (rename) +# Removes dst if exists +# Non-atomic +# Depends on ctypes on Windows +# Throws OSError +@errorfix_win +def replace(src, dst): + try: + move(src, dst) + except OSError as e: + if e.errno not in (errno.EEXIST, errno.EISDIR, errno.ENOTDIR, errno.ENOTEMPTY): + raise + remove_tree(dst) + move(src, dst) + + +# Atomic file remove +# Throws OSError +@errorfix_win @library.python.windows.diehard(library.python.windows.RETRIABLE_FILE_ERRORS, tries=_diehard_win_tries) -def remove_file(path): - os.remove(path) - - -# Atomic empty directory remove -# Throws OSError -@errorfix_win +def remove_file(path): + os.remove(path) + + +# Atomic empty directory remove +# Throws OSError +@errorfix_win @library.python.windows.diehard(library.python.windows.RETRIABLE_DIR_ERRORS, tries=_diehard_win_tries) -def remove_dir(path): - os.rmdir(path) - - +def remove_dir(path): + os.rmdir(path) + + def fix_path_encoding(path): return library.python.strings.to_str(path, library.python.strings.fs_encoding()) -# File/directory remove -# Non-atomic -# Throws OSError, AssertionError -@errorfix_win -def remove_tree(path): +# File/directory remove +# Non-atomic +# Throws OSError, AssertionError +@errorfix_win +def remove_tree(path): @library.python.windows.diehard(library.python.windows.RETRIABLE_DIR_ERRORS, tries=_diehard_win_tries) - def rmtree(path): + def rmtree(path): if library.python.windows.on_win(): library.python.windows.rmtree(path) else: shutil.rmtree(fix_path_encoding(path)) - - st = os.lstat(path) - if stat.S_ISLNK(st.st_mode) or stat.S_ISREG(st.st_mode): - remove_file(path) - elif stat.S_ISDIR(st.st_mode): - rmtree(path) - else: - assert False - - -# File/directory remove ignoring errors -# Non-atomic -@errorfix_win -def remove_tree_safe(path): - try: - st = os.lstat(path) - if stat.S_ISLNK(st.st_mode) or stat.S_ISREG(st.st_mode): - os.remove(path) - elif stat.S_ISDIR(st.st_mode): + + st = os.lstat(path) + if stat.S_ISLNK(st.st_mode) or stat.S_ISREG(st.st_mode): + remove_file(path) + elif stat.S_ISDIR(st.st_mode): + rmtree(path) + else: + assert False + + +# File/directory remove ignoring errors +# Non-atomic +@errorfix_win +def remove_tree_safe(path): + try: + st = os.lstat(path) + if stat.S_ISLNK(st.st_mode) or stat.S_ISREG(st.st_mode): + os.remove(path) + elif stat.S_ISDIR(st.st_mode): shutil.rmtree(fix_path_encoding(path), ignore_errors=True) # XXX except UnicodeDecodeError as e: logging.exception(u'remove_tree_safe with argument %s raise exception: %s', path, e) raise - except OSError: - pass - - -# File/directory remove -# If path doesn't exist - does nothing -# Non-atomic -# Throws OSError, AssertionError -@errorfix_win -def ensure_removed(path): - try: - remove_tree(path) - except OSError as e: - if e.errno != errno.ENOENT: - raise - - -# Atomic file hardlink -# Dst must not exist -# Depends on ctypes on Windows -# Throws OSError -# If dst exists - throws OSError (errno EEXIST) -@errorfix_win -def hardlink(src, lnk): + except OSError: + pass + + +# File/directory remove +# If path doesn't exist - does nothing +# Non-atomic +# Throws OSError, AssertionError +@errorfix_win +def ensure_removed(path): + try: + remove_tree(path) + except OSError as e: + if e.errno != errno.ENOENT: + raise + + +# Atomic file hardlink +# Dst must not exist +# Depends on ctypes on Windows +# Throws OSError +# If dst exists - throws OSError (errno EEXIST) +@errorfix_win +def hardlink(src, lnk): if library.python.windows.on_win(): library.python.windows.hardlink(src, lnk) - else: - os.link(src, lnk) - - + else: + os.link(src, lnk) + + @errorfix_win def hardlink_or_copy(src, lnk): def should_fallback_to_copy(exc): @@ -222,18 +222,18 @@ def hardlink_or_copy(src, lnk): raise -# Atomic file/directory symlink (Unix only) -# Dst must not exist -# Throws OSError -# If dst exists - throws OSError (errno EEXIST) -@errorfix_win -def symlink(src, lnk): +# Atomic file/directory symlink (Unix only) +# Dst must not exist +# Throws OSError +# If dst exists - throws OSError (errno EEXIST) +@errorfix_win +def symlink(src, lnk): if library.python.windows.on_win(): library.python.windows.run_disabled(src, lnk) - else: - os.symlink(src, lnk) - - + else: + os.symlink(src, lnk) + + # shutil.copy2 with follow_symlinks=False parameter (Unix only) def copy2(src, lnk, follow_symlinks=True): if six.PY3: @@ -247,69 +247,69 @@ def copy2(src, lnk, follow_symlinks=True): symlink(os.readlink(src), lnk) -# Recursively hardlink directory -# Uses plain hardlink for files -# Dst must not exist -# Non-atomic -# Throws OSError -@errorfix_win -def hardlink_tree(src, dst): - if not os.path.exists(src): - raise CustomFsError(errno.ENOENT, filename=src) - if os.path.isfile(src): - hardlink(src, dst) - return +# Recursively hardlink directory +# Uses plain hardlink for files +# Dst must not exist +# Non-atomic +# Throws OSError +@errorfix_win +def hardlink_tree(src, dst): + if not os.path.exists(src): + raise CustomFsError(errno.ENOENT, filename=src) + if os.path.isfile(src): + hardlink(src, dst) + return for dirpath, _, filenames in walk_relative(src): - src_dirpath = os.path.join(src, dirpath) if dirpath != '.' else src - dst_dirpath = os.path.join(dst, dirpath) if dirpath != '.' else dst - os.mkdir(dst_dirpath) - for filename in filenames: - hardlink(os.path.join(src_dirpath, filename), os.path.join(dst_dirpath, filename)) - - -# File copy -# throws EnvironmentError (OSError, IOError) -@errorfix_win + src_dirpath = os.path.join(src, dirpath) if dirpath != '.' else src + dst_dirpath = os.path.join(dst, dirpath) if dirpath != '.' else dst + os.mkdir(dst_dirpath) + for filename in filenames: + hardlink(os.path.join(src_dirpath, filename), os.path.join(dst_dirpath, filename)) + + +# File copy +# throws EnvironmentError (OSError, IOError) +@errorfix_win def copy_file(src, dst, copy_function=shutil.copy2): - if os.path.isdir(dst): - raise CustomFsError(errno.EISDIR, filename=dst) + if os.path.isdir(dst): + raise CustomFsError(errno.EISDIR, filename=dst) copy_function(src, dst) - - -# File/directory copy -# throws EnvironmentError (OSError, IOError, shutil.Error) -@errorfix_win + + +# File/directory copy +# throws EnvironmentError (OSError, IOError, shutil.Error) +@errorfix_win def copy_tree(src, dst, copy_function=shutil.copy2): - if os.path.isfile(src): + if os.path.isfile(src): copy_file(src, dst, copy_function=copy_function) - return + return copytree3(src, dst, copy_function=copy_function) - - -# File read -# Throws OSError -@errorfix_win -def read_file(path, binary=True): - with open(path, 'r' + ('b' if binary else '')) as f: - return f.read() - - -# Decoding file read -# Throws OSError -@errorfix_win -def read_file_unicode(path, binary=True, enc='utf-8'): - if not binary: + + +# File read +# Throws OSError +@errorfix_win +def read_file(path, binary=True): + with open(path, 'r' + ('b' if binary else '')) as f: + return f.read() + + +# Decoding file read +# Throws OSError +@errorfix_win +def read_file_unicode(path, binary=True, enc='utf-8'): + if not binary: if six.PY2: with open(path, 'r') as f: return library.python.strings.to_unicode(f.read(), enc) else: with open(path, 'r', encoding=enc) as f: return f.read() - # codecs.open is always binary + # codecs.open is always binary with codecs.open(path, 'r', encoding=enc, errors=library.python.strings.ENCODING_ERRORS_POLICY) as f: - return f.read() - - + return f.read() + + @errorfix_win def open_file(*args, **kwargs): return ( @@ -317,52 +317,52 @@ def open_file(*args, **kwargs): ) -# Atomic file write -# Throws OSError -@errorfix_win -def write_file(path, data, binary=True): - dir_path = os.path.dirname(path) - if dir_path: - ensure_dir(dir_path) - tmp_path = path + '.tmp.' + str(random.random()) +# Atomic file write +# Throws OSError +@errorfix_win +def write_file(path, data, binary=True): + dir_path = os.path.dirname(path) + if dir_path: + ensure_dir(dir_path) + tmp_path = path + '.tmp.' + str(random.random()) with open_file(tmp_path, 'w' + ('b' if binary else '')) as f: if not isinstance(data, bytes) and binary: data = data.encode('UTF-8') - f.write(data) - replace_file(tmp_path, path) - - -# File size -# Throws OSError -@errorfix_win -def get_file_size(path): - return os.path.getsize(path) - - -# File/directory size -# Non-recursive mode for directory counts size for immediates -# While raise_all_errors is set to False, file size fallbacks to zero in case of getsize errors -# Throws OSError -@errorfix_win -def get_tree_size(path, recursive=False, raise_all_errors=False): - if os.path.isfile(path): - return get_file_size(path) - total_size = 0 - for dir_path, _, files in os.walk(path): - for f in files: - fp = os.path.join(dir_path, f) - try: - total_size += get_file_size(fp) - except OSError as e: - if raise_all_errors: - raise + f.write(data) + replace_file(tmp_path, path) + + +# File size +# Throws OSError +@errorfix_win +def get_file_size(path): + return os.path.getsize(path) + + +# File/directory size +# Non-recursive mode for directory counts size for immediates +# While raise_all_errors is set to False, file size fallbacks to zero in case of getsize errors +# Throws OSError +@errorfix_win +def get_tree_size(path, recursive=False, raise_all_errors=False): + if os.path.isfile(path): + return get_file_size(path) + total_size = 0 + for dir_path, _, files in os.walk(path): + for f in files: + fp = os.path.join(dir_path, f) + try: + total_size += get_file_size(fp) + except OSError as e: + if raise_all_errors: + raise logger.debug("Cannot calculate file size: %s", e) - if not recursive: - break - return total_size - - -# Directory copy ported from Python 3 + if not recursive: + break + return total_size + + +# Directory copy ported from Python 3 def copytree3( src, dst, diff --git a/library/python/fs/test/test_fs.py b/library/python/fs/test/test_fs.py index 3aaebd2643..9e2c70c069 100644 --- a/library/python/fs/test/test_fs.py +++ b/library/python/fs/test/test_fs.py @@ -1,961 +1,961 @@ -# coding=utf-8 - -import errno -import os -import pytest +# coding=utf-8 + +import errno +import os +import pytest import shutil import six - + import library.python.fs import library.python.strings import library.python.tmp import library.python.windows - + import yatest.common - -def in_env(case): - def wrapped_case(*args, **kwargs): + +def in_env(case): + def wrapped_case(*args, **kwargs): with library.python.tmp.temp_dir() as temp_dir: - case(lambda path: os.path.join(temp_dir, path)) + case(lambda path: os.path.join(temp_dir, path)) - return wrapped_case - - -def mkfile(path, data=''): + return wrapped_case + + +def mkfile(path, data=''): with open(path, 'wb') as f: - if data: + if data: f.write(data) if isinstance(data, six.binary_type) else f.write( data.encode(library.python.strings.fs_encoding()) ) - - -def mktree_example(path, name): - os.mkdir(path(name)) - mkfile(path(name + '/file1'), 'FILE1') - os.mkdir(path(name + '/dir1')) - os.mkdir(path(name + '/dir2')) - mkfile(path(name + '/dir2/file2'), 'FILE2') - mkfile(path(name + '/dir2/file3'), 'FILE3') - - -def file_data(path): + + +def mktree_example(path, name): + os.mkdir(path(name)) + mkfile(path(name + '/file1'), 'FILE1') + os.mkdir(path(name + '/dir1')) + os.mkdir(path(name + '/dir2')) + mkfile(path(name + '/dir2/file2'), 'FILE2') + mkfile(path(name + '/dir2/file3'), 'FILE3') + + +def file_data(path): with open(path, 'rb') as f: return f.read().decode('utf-8') - - -def serialize_tree(path): - if os.path.isfile(path): - return file_data(path) - data = {'dirs': set(), 'files': {}} - for dirpath, dirnames, filenames in os.walk(path): - dirpath_rel = os.path.relpath(dirpath, path) - if dirpath_rel == '.': - dirpath_rel = '' - data['dirs'].update(set(os.path.join(dirpath_rel, x) for x in dirnames)) - data['files'].update({os.path.join(dirpath_rel, x): file_data(os.path.join(dirpath, x)) for x in filenames}) - return data - - -def trees_equal(dir1, dir2): - return serialize_tree(dir1) == serialize_tree(dir2) - - -def inodes_unsupported(): + + +def serialize_tree(path): + if os.path.isfile(path): + return file_data(path) + data = {'dirs': set(), 'files': {}} + for dirpath, dirnames, filenames in os.walk(path): + dirpath_rel = os.path.relpath(dirpath, path) + if dirpath_rel == '.': + dirpath_rel = '' + data['dirs'].update(set(os.path.join(dirpath_rel, x) for x in dirnames)) + data['files'].update({os.path.join(dirpath_rel, x): file_data(os.path.join(dirpath, x)) for x in filenames}) + return data + + +def trees_equal(dir1, dir2): + return serialize_tree(dir1) == serialize_tree(dir2) + + +def inodes_unsupported(): return library.python.windows.on_win() - - -def inodes_equal(path1, path2): - return os.stat(path1).st_ino == os.stat(path2).st_ino - - -def gen_error_access_denied(): + + +def inodes_equal(path1, path2): + return os.stat(path1).st_ino == os.stat(path2).st_ino + + +def gen_error_access_denied(): if library.python.windows.on_win(): - err = WindowsError() - err.errno = errno.EACCES - err.strerror = '' + err = WindowsError() + err.errno = errno.EACCES + err.strerror = '' err.winerror = library.python.windows.ERRORS['ACCESS_DENIED'] - else: - err = OSError() - err.errno = errno.EACCES - err.strerror = os.strerror(err.errno) - err.filename = 'unknown/file' - raise err - - -def test_errorfix_win(): + else: + err = OSError() + err.errno = errno.EACCES + err.strerror = os.strerror(err.errno) + err.filename = 'unknown/file' + raise err + + +def test_errorfix_win(): @library.python.fs.errorfix_win - def erroneous_func(): - gen_error_access_denied() - - with pytest.raises(OSError) as errinfo: - erroneous_func() - assert errinfo.value.errno == errno.EACCES - assert errinfo.value.filename == 'unknown/file' + def erroneous_func(): + gen_error_access_denied() + + with pytest.raises(OSError) as errinfo: + erroneous_func() + assert errinfo.value.errno == errno.EACCES + assert errinfo.value.filename == 'unknown/file' # See transcode_error, which encodes strerror, in library/python/windows/__init__.py assert isinstance(errinfo.value.strerror, (six.binary_type, six.text_type)) - assert errinfo.value.strerror - - -def test_custom_fs_error(): - with pytest.raises(OSError) as errinfo: + assert errinfo.value.strerror + + +def test_custom_fs_error(): + with pytest.raises(OSError) as errinfo: raise library.python.fs.CustomFsError(errno.EACCES, filename='some/file') - assert errinfo.value.errno == errno.EACCES + assert errinfo.value.errno == errno.EACCES # See transcode_error, which encodes strerror, in library/python/windows/__init__.py assert isinstance(errinfo.value.strerror, (six.binary_type, six.text_type)) - assert errinfo.value.filename == 'some/file' - - -@in_env -def test_ensure_dir(path): + assert errinfo.value.filename == 'some/file' + + +@in_env +def test_ensure_dir(path): library.python.fs.ensure_dir(path('dir/subdir')) - assert os.path.isdir(path('dir')) - assert os.path.isdir(path('dir/subdir')) - - -@in_env -def test_ensure_dir_exists(path): - os.makedirs(path('dir/subdir')) + assert os.path.isdir(path('dir')) + assert os.path.isdir(path('dir/subdir')) + + +@in_env +def test_ensure_dir_exists(path): + os.makedirs(path('dir/subdir')) library.python.fs.ensure_dir(path('dir/subdir')) - assert os.path.isdir(path('dir')) - assert os.path.isdir(path('dir/subdir')) - - -@in_env -def test_ensure_dir_exists_partly(path): - os.mkdir(path('dir')) + assert os.path.isdir(path('dir')) + assert os.path.isdir(path('dir/subdir')) + + +@in_env +def test_ensure_dir_exists_partly(path): + os.mkdir(path('dir')) library.python.fs.ensure_dir(path('dir/subdir')) - assert os.path.isdir(path('dir')) - assert os.path.isdir(path('dir/subdir')) - - -@in_env -def test_ensure_dir_exists_file(path): - mkfile(path('dir')) - with pytest.raises(OSError) as errinfo: + assert os.path.isdir(path('dir')) + assert os.path.isdir(path('dir/subdir')) + + +@in_env +def test_ensure_dir_exists_file(path): + mkfile(path('dir')) + with pytest.raises(OSError) as errinfo: library.python.fs.ensure_dir(path('dir/subdir')) - # ENOENT on Windows! - assert errinfo.value.errno in (errno.ENOTDIR, errno.ENOENT) - assert os.path.isfile(path('dir')) - - -@in_env -def test_create_dirs(path): + # ENOENT on Windows! + assert errinfo.value.errno in (errno.ENOTDIR, errno.ENOENT) + assert os.path.isfile(path('dir')) + + +@in_env +def test_create_dirs(path): assert library.python.fs.create_dirs(path('dir/subdir')) == path('dir/subdir') - assert os.path.isdir(path('dir')) - assert os.path.isdir(path('dir/subdir')) - - -@in_env -def test_move_file(path): - mkfile(path('src'), 'SRC') + assert os.path.isdir(path('dir')) + assert os.path.isdir(path('dir/subdir')) + + +@in_env +def test_move_file(path): + mkfile(path('src'), 'SRC') library.python.fs.move(path('src'), path('dst')) - assert not os.path.isfile(path('src')) - assert os.path.isfile(path('dst')) - assert file_data(path('dst')) == 'SRC' - - -@in_env -def test_move_file_no_src(path): - with pytest.raises(OSError) as errinfo: + assert not os.path.isfile(path('src')) + assert os.path.isfile(path('dst')) + assert file_data(path('dst')) == 'SRC' + + +@in_env +def test_move_file_no_src(path): + with pytest.raises(OSError) as errinfo: library.python.fs.move(path('src'), path('dst')) - assert errinfo.value.errno == errno.ENOENT - - -@in_env -def test_move_file_exists(path): - mkfile(path('src'), 'SRC') - mkfile(path('dst'), 'DST') + assert errinfo.value.errno == errno.ENOENT + + +@in_env +def test_move_file_exists(path): + mkfile(path('src'), 'SRC') + mkfile(path('dst'), 'DST') if library.python.windows.on_win(): - # move is platform-dependent, use replace_file for dst replacement on all platforms - with pytest.raises(OSError) as errinfo: + # move is platform-dependent, use replace_file for dst replacement on all platforms + with pytest.raises(OSError) as errinfo: library.python.fs.move(path('src'), path('dst')) - assert errinfo.value.errno == errno.EEXIST - assert os.path.isfile(path('src')) - assert os.path.isfile(path('dst')) - assert file_data(path('dst')) == 'DST' - else: + assert errinfo.value.errno == errno.EEXIST + assert os.path.isfile(path('src')) + assert os.path.isfile(path('dst')) + assert file_data(path('dst')) == 'DST' + else: library.python.fs.move(path('src'), path('dst')) - assert not os.path.isfile(path('src')) - assert os.path.isfile(path('dst')) - assert file_data(path('dst')) == 'SRC' - - -@in_env -def test_move_file_exists_dir_empty(path): - mkfile(path('src'), 'SRC') - os.mkdir(path('dst')) - with pytest.raises(OSError) as errinfo: + assert not os.path.isfile(path('src')) + assert os.path.isfile(path('dst')) + assert file_data(path('dst')) == 'SRC' + + +@in_env +def test_move_file_exists_dir_empty(path): + mkfile(path('src'), 'SRC') + os.mkdir(path('dst')) + with pytest.raises(OSError) as errinfo: library.python.fs.move(path('src'), path('dst')) - assert errinfo.value.errno in (errno.EEXIST, errno.EISDIR) - assert os.path.isfile(path('src')) - assert os.path.isdir(path('dst')) - assert not os.path.isfile(path('dst/src')) - - -@in_env -def test_move_file_exists_dir_nonempty(path): - mkfile(path('src'), 'SRC') - os.mkdir(path('dst')) - mkfile(path('dst/dst_file')) - with pytest.raises(OSError) as errinfo: + assert errinfo.value.errno in (errno.EEXIST, errno.EISDIR) + assert os.path.isfile(path('src')) + assert os.path.isdir(path('dst')) + assert not os.path.isfile(path('dst/src')) + + +@in_env +def test_move_file_exists_dir_nonempty(path): + mkfile(path('src'), 'SRC') + os.mkdir(path('dst')) + mkfile(path('dst/dst_file')) + with pytest.raises(OSError) as errinfo: library.python.fs.move(path('src'), path('dst')) - assert errinfo.value.errno in (errno.EEXIST, errno.EISDIR) - assert os.path.isfile(path('src')) - assert os.path.isdir(path('dst')) - assert os.path.isfile(path('dst/dst_file')) - assert not os.path.isfile(path('dst/src')) - - -@in_env -def test_move_dir(path): - os.mkdir(path('src')) - mkfile(path('src/src_file')) + assert errinfo.value.errno in (errno.EEXIST, errno.EISDIR) + assert os.path.isfile(path('src')) + assert os.path.isdir(path('dst')) + assert os.path.isfile(path('dst/dst_file')) + assert not os.path.isfile(path('dst/src')) + + +@in_env +def test_move_dir(path): + os.mkdir(path('src')) + mkfile(path('src/src_file')) library.python.fs.move(path('src'), path('dst')) - assert not os.path.isdir(path('src')) - assert os.path.isdir(path('dst')) - assert os.path.isfile(path('dst/src_file')) - - -@in_env -def test_move_dir_exists_empty(path): - os.mkdir(path('src')) - mkfile(path('src/src_file')) - os.mkdir(path('dst')) + assert not os.path.isdir(path('src')) + assert os.path.isdir(path('dst')) + assert os.path.isfile(path('dst/src_file')) + + +@in_env +def test_move_dir_exists_empty(path): + os.mkdir(path('src')) + mkfile(path('src/src_file')) + os.mkdir(path('dst')) if library.python.windows.on_win(): - # move is platform-dependent, use non-atomic replace for directory replacement - with pytest.raises(OSError) as errinfo: + # move is platform-dependent, use non-atomic replace for directory replacement + with pytest.raises(OSError) as errinfo: library.python.fs.move(path('src'), path('dst')) - assert errinfo.value.errno == errno.EEXIST - assert os.path.isdir(path('src')) - assert os.path.isdir(path('dst')) - assert not os.path.isfile(path('dst/src_file')) - else: + assert errinfo.value.errno == errno.EEXIST + assert os.path.isdir(path('src')) + assert os.path.isdir(path('dst')) + assert not os.path.isfile(path('dst/src_file')) + else: library.python.fs.move(path('src'), path('dst')) - assert not os.path.isdir(path('src')) - assert os.path.isdir(path('dst')) - assert os.path.isfile(path('dst/src_file')) - - -@in_env -def test_move_dir_exists_nonempty(path): - os.mkdir(path('src')) - mkfile(path('src/src_file')) - os.mkdir(path('dst')) - mkfile(path('dst/dst_file')) - with pytest.raises(OSError) as errinfo: + assert not os.path.isdir(path('src')) + assert os.path.isdir(path('dst')) + assert os.path.isfile(path('dst/src_file')) + + +@in_env +def test_move_dir_exists_nonempty(path): + os.mkdir(path('src')) + mkfile(path('src/src_file')) + os.mkdir(path('dst')) + mkfile(path('dst/dst_file')) + with pytest.raises(OSError) as errinfo: library.python.fs.move(path('src'), path('dst')) - assert errinfo.value.errno in (errno.EEXIST, errno.ENOTEMPTY) - assert os.path.isdir(path('src')) - assert os.path.isfile(path('src/src_file')) - assert os.path.isdir(path('dst')) - assert not os.path.isfile(path('dst/src_file')) - assert os.path.isfile(path('dst/dst_file')) - - -@in_env -def test_move_dir_exists_file(path): - os.mkdir(path('src')) - mkfile(path('src/src_file')) - mkfile(path('dst'), 'DST') - with pytest.raises(OSError) as errinfo: + assert errinfo.value.errno in (errno.EEXIST, errno.ENOTEMPTY) + assert os.path.isdir(path('src')) + assert os.path.isfile(path('src/src_file')) + assert os.path.isdir(path('dst')) + assert not os.path.isfile(path('dst/src_file')) + assert os.path.isfile(path('dst/dst_file')) + + +@in_env +def test_move_dir_exists_file(path): + os.mkdir(path('src')) + mkfile(path('src/src_file')) + mkfile(path('dst'), 'DST') + with pytest.raises(OSError) as errinfo: library.python.fs.move(path('src'), path('dst')) - assert errinfo.value.errno in (errno.EEXIST, errno.ENOTDIR) - assert os.path.isdir(path('src')) - assert os.path.isfile(path('dst')) - assert file_data(path('dst')) == 'DST' - - -@in_env -def test_replace_file(path): - mkfile(path('src'), 'SRC') + assert errinfo.value.errno in (errno.EEXIST, errno.ENOTDIR) + assert os.path.isdir(path('src')) + assert os.path.isfile(path('dst')) + assert file_data(path('dst')) == 'DST' + + +@in_env +def test_replace_file(path): + mkfile(path('src'), 'SRC') library.python.fs.replace_file(path('src'), path('dst')) - assert not os.path.isfile(path('src')) - assert os.path.isfile(path('dst')) - assert file_data(path('dst')) == 'SRC' - - mkfile(path('src'), 'SRC') + assert not os.path.isfile(path('src')) + assert os.path.isfile(path('dst')) + assert file_data(path('dst')) == 'SRC' + + mkfile(path('src'), 'SRC') library.python.fs.replace(path('src'), path('dst2')) - assert not os.path.isfile(path('src')) - assert os.path.isfile(path('dst2')) - assert file_data(path('dst2')) == 'SRC' - - -@in_env -def test_replace_file_no_src(path): - with pytest.raises(OSError) as errinfo: + assert not os.path.isfile(path('src')) + assert os.path.isfile(path('dst2')) + assert file_data(path('dst2')) == 'SRC' + + +@in_env +def test_replace_file_no_src(path): + with pytest.raises(OSError) as errinfo: library.python.fs.replace_file(path('src'), path('dst')) - assert errinfo.value.errno == errno.ENOENT - - with pytest.raises(OSError) as errinfo2: + assert errinfo.value.errno == errno.ENOENT + + with pytest.raises(OSError) as errinfo2: library.python.fs.replace(path('src'), path('dst2')) - assert errinfo2.value.errno == errno.ENOENT - - -@in_env -def test_replace_file_exists(path): - mkfile(path('src'), 'SRC') - mkfile(path('dst'), 'DST') + assert errinfo2.value.errno == errno.ENOENT + + +@in_env +def test_replace_file_exists(path): + mkfile(path('src'), 'SRC') + mkfile(path('dst'), 'DST') library.python.fs.replace_file(path('src'), path('dst')) - assert not os.path.isfile(path('src')) - assert os.path.isfile(path('dst')) - assert file_data(path('dst')) == 'SRC' - - mkfile(path('src'), 'SRC') - mkfile(path('dst2'), 'DST') + assert not os.path.isfile(path('src')) + assert os.path.isfile(path('dst')) + assert file_data(path('dst')) == 'SRC' + + mkfile(path('src'), 'SRC') + mkfile(path('dst2'), 'DST') library.python.fs.replace(path('src'), path('dst2')) - assert not os.path.isfile(path('src')) - assert os.path.isfile(path('dst2')) - assert file_data(path('dst2')) == 'SRC' - - -@in_env -def test_replace_file_exists_dir_empty(path): - mkfile(path('src'), 'SRC') - os.mkdir(path('dst')) - with pytest.raises(OSError) as errinfo: + assert not os.path.isfile(path('src')) + assert os.path.isfile(path('dst2')) + assert file_data(path('dst2')) == 'SRC' + + +@in_env +def test_replace_file_exists_dir_empty(path): + mkfile(path('src'), 'SRC') + os.mkdir(path('dst')) + with pytest.raises(OSError) as errinfo: library.python.fs.replace_file(path('src'), path('dst')) - assert errinfo.value.errno in (errno.EISDIR, errno.EACCES) - assert os.path.isfile(path('src')) - assert os.path.isdir(path('dst')) - assert not os.path.isfile(path('dst/src')) - - -@in_env -def test_replace_file_exists_dir_empty_overwrite(path): - mkfile(path('src'), 'SRC') - os.mkdir(path('dst')) + assert errinfo.value.errno in (errno.EISDIR, errno.EACCES) + assert os.path.isfile(path('src')) + assert os.path.isdir(path('dst')) + assert not os.path.isfile(path('dst/src')) + + +@in_env +def test_replace_file_exists_dir_empty_overwrite(path): + mkfile(path('src'), 'SRC') + os.mkdir(path('dst')) library.python.fs.replace(path('src'), path('dst')) - assert not os.path.isfile(path('src')) - assert os.path.isfile(path('dst')) - assert file_data(path('dst')) == 'SRC' - - -@in_env -def test_replace_file_exists_dir_nonempty(path): - mkfile(path('src'), 'SRC') - os.mkdir(path('dst')) - mkfile(path('dst/dst_file')) - with pytest.raises(OSError) as errinfo: + assert not os.path.isfile(path('src')) + assert os.path.isfile(path('dst')) + assert file_data(path('dst')) == 'SRC' + + +@in_env +def test_replace_file_exists_dir_nonempty(path): + mkfile(path('src'), 'SRC') + os.mkdir(path('dst')) + mkfile(path('dst/dst_file')) + with pytest.raises(OSError) as errinfo: library.python.fs.replace_file(path('src'), path('dst')) - assert errinfo.value.errno in (errno.EISDIR, errno.EACCES) - assert os.path.isfile(path('src')) - assert os.path.isdir(path('dst')) - assert os.path.isfile(path('dst/dst_file')) - assert not os.path.isfile(path('dst/src')) - - -@in_env -def test_replace_file_exists_dir_nonempty_overwrite(path): - mkfile(path('src'), 'SRC') - os.mkdir(path('dst')) - mkfile(path('dst/dst_file')) + assert errinfo.value.errno in (errno.EISDIR, errno.EACCES) + assert os.path.isfile(path('src')) + assert os.path.isdir(path('dst')) + assert os.path.isfile(path('dst/dst_file')) + assert not os.path.isfile(path('dst/src')) + + +@in_env +def test_replace_file_exists_dir_nonempty_overwrite(path): + mkfile(path('src'), 'SRC') + os.mkdir(path('dst')) + mkfile(path('dst/dst_file')) library.python.fs.replace(path('src'), path('dst')) - assert not os.path.isfile(path('src')) - assert os.path.isfile(path('dst')) - assert file_data(path('dst')) == 'SRC' - - -@in_env -def test_replace_dir(path): - os.mkdir(path('src')) - mkfile(path('src/src_file')) + assert not os.path.isfile(path('src')) + assert os.path.isfile(path('dst')) + assert file_data(path('dst')) == 'SRC' + + +@in_env +def test_replace_dir(path): + os.mkdir(path('src')) + mkfile(path('src/src_file')) library.python.fs.replace(path('src'), path('dst')) - assert not os.path.isdir(path('src')) - assert os.path.isdir(path('dst')) - assert os.path.isfile(path('dst/src_file')) - - -@in_env -def test_replace_dir_exists_empty(path): - os.mkdir(path('src')) - mkfile(path('src/src_file')) - os.mkdir(path('dst')) + assert not os.path.isdir(path('src')) + assert os.path.isdir(path('dst')) + assert os.path.isfile(path('dst/src_file')) + + +@in_env +def test_replace_dir_exists_empty(path): + os.mkdir(path('src')) + mkfile(path('src/src_file')) + os.mkdir(path('dst')) library.python.fs.replace(path('src'), path('dst')) - assert not os.path.isdir(path('src')) - assert os.path.isdir(path('dst')) - assert os.path.isfile(path('dst/src_file')) - - -@in_env -def test_replace_dir_exists_nonempty(path): - os.mkdir(path('src')) - mkfile(path('src/src_file')) - os.mkdir(path('dst')) - mkfile(path('dst/dst_file')) + assert not os.path.isdir(path('src')) + assert os.path.isdir(path('dst')) + assert os.path.isfile(path('dst/src_file')) + + +@in_env +def test_replace_dir_exists_nonempty(path): + os.mkdir(path('src')) + mkfile(path('src/src_file')) + os.mkdir(path('dst')) + mkfile(path('dst/dst_file')) library.python.fs.replace(path('src'), path('dst')) - assert not os.path.isdir(path('src')) - assert os.path.isdir(path('dst')) - assert os.path.isfile(path('dst/src_file')) - assert not os.path.isfile(path('dst/dst_file')) - - -@in_env -def test_replace_dir_exists_file(path): - os.mkdir(path('src')) - mkfile(path('src/src_file')) - mkfile(path('dst'), 'DST') + assert not os.path.isdir(path('src')) + assert os.path.isdir(path('dst')) + assert os.path.isfile(path('dst/src_file')) + assert not os.path.isfile(path('dst/dst_file')) + + +@in_env +def test_replace_dir_exists_file(path): + os.mkdir(path('src')) + mkfile(path('src/src_file')) + mkfile(path('dst'), 'DST') library.python.fs.replace(path('src'), path('dst')) - assert not os.path.isdir(path('src')) - assert os.path.isdir(path('dst')) - assert os.path.isfile(path('dst/src_file')) - - -@in_env -def test_remove_file(path): - mkfile(path('path')) + assert not os.path.isdir(path('src')) + assert os.path.isdir(path('dst')) + assert os.path.isfile(path('dst/src_file')) + + +@in_env +def test_remove_file(path): + mkfile(path('path')) library.python.fs.remove_file(path('path')) - assert not os.path.exists(path('path')) - - -@in_env -def test_remove_file_no(path): - with pytest.raises(OSError) as errinfo: + assert not os.path.exists(path('path')) + + +@in_env +def test_remove_file_no(path): + with pytest.raises(OSError) as errinfo: library.python.fs.remove_file(path('path')) - assert errinfo.value.errno == errno.ENOENT - - -@in_env -def test_remove_file_exists_dir(path): - os.mkdir(path('path')) - with pytest.raises(OSError) as errinfo: + assert errinfo.value.errno == errno.ENOENT + + +@in_env +def test_remove_file_exists_dir(path): + os.mkdir(path('path')) + with pytest.raises(OSError) as errinfo: library.python.fs.remove_file(path('path')) - assert errinfo.value.errno in (errno.EISDIR, errno.EACCES) - assert os.path.isdir(path('path')) - - -@in_env -def test_remove_dir(path): - os.mkdir(path('path')) + assert errinfo.value.errno in (errno.EISDIR, errno.EACCES) + assert os.path.isdir(path('path')) + + +@in_env +def test_remove_dir(path): + os.mkdir(path('path')) library.python.fs.remove_dir(path('path')) - assert not os.path.exists(path('path')) - - -@in_env -def test_remove_dir_no(path): - with pytest.raises(OSError) as errinfo: + assert not os.path.exists(path('path')) + + +@in_env +def test_remove_dir_no(path): + with pytest.raises(OSError) as errinfo: library.python.fs.remove_dir(path('path')) - assert errinfo.value.errno == errno.ENOENT - - -@in_env -def test_remove_dir_exists_file(path): - mkfile(path('path')) - with pytest.raises(OSError) as errinfo: + assert errinfo.value.errno == errno.ENOENT + + +@in_env +def test_remove_dir_exists_file(path): + mkfile(path('path')) + with pytest.raises(OSError) as errinfo: library.python.fs.remove_dir(path('path')) - assert errinfo.value.errno in (errno.ENOTDIR, errno.EINVAL) - assert os.path.isfile(path('path')) - - -@in_env -def test_remove_tree(path): - mktree_example(path, 'path') + assert errinfo.value.errno in (errno.ENOTDIR, errno.EINVAL) + assert os.path.isfile(path('path')) + + +@in_env +def test_remove_tree(path): + mktree_example(path, 'path') library.python.fs.remove_tree(path('path')) - assert not os.path.exists(path('path')) - - -@in_env -def test_remove_tree_empty(path): - os.mkdir(path('path')) + assert not os.path.exists(path('path')) + + +@in_env +def test_remove_tree_empty(path): + os.mkdir(path('path')) library.python.fs.remove_tree(path('path')) - assert not os.path.exists(path('path')) - - -@in_env -def test_remove_tree_file(path): - mkfile(path('path')) + assert not os.path.exists(path('path')) + + +@in_env +def test_remove_tree_file(path): + mkfile(path('path')) library.python.fs.remove_tree(path('path')) - assert not os.path.exists(path('path')) - - -@in_env -def test_remove_tree_no(path): - with pytest.raises(OSError) as errinfo: + assert not os.path.exists(path('path')) + + +@in_env +def test_remove_tree_no(path): + with pytest.raises(OSError) as errinfo: library.python.fs.remove_tree(path('path')) - assert errinfo.value.errno == errno.ENOENT - - -@in_env -def test_remove_tree_safe(path): + assert errinfo.value.errno == errno.ENOENT + + +@in_env +def test_remove_tree_safe(path): library.python.fs.remove_tree_safe(path('path')) - - -@in_env -def test_ensure_removed(path): + + +@in_env +def test_ensure_removed(path): library.python.fs.ensure_removed(path('path')) - - -@in_env -def test_ensure_removed_exists(path): - os.makedirs(path('dir/subdir')) + + +@in_env +def test_ensure_removed_exists(path): + os.makedirs(path('dir/subdir')) library.python.fs.ensure_removed(path('dir')) - assert not os.path.exists(path('dir')) - - -@in_env -def test_ensure_removed_exists_precise(path): - os.makedirs(path('dir/subdir')) + assert not os.path.exists(path('dir')) + + +@in_env +def test_ensure_removed_exists_precise(path): + os.makedirs(path('dir/subdir')) library.python.fs.ensure_removed(path('dir/subdir')) - assert os.path.exists(path('dir')) - assert not os.path.exists(path('dir/subdir')) - - -@in_env -def test_hardlink_file(path): - mkfile(path('src'), 'SRC') + assert os.path.exists(path('dir')) + assert not os.path.exists(path('dir/subdir')) + + +@in_env +def test_hardlink_file(path): + mkfile(path('src'), 'SRC') library.python.fs.hardlink(path('src'), path('dst')) - assert os.path.isfile(path('src')) - assert os.path.isfile(path('dst')) - assert file_data(path('dst')) == 'SRC' - assert inodes_unsupported() or inodes_equal(path('src'), path('dst')) - - -@in_env -def test_hardlink_file_no_src(path): - with pytest.raises(OSError) as errinfo: + assert os.path.isfile(path('src')) + assert os.path.isfile(path('dst')) + assert file_data(path('dst')) == 'SRC' + assert inodes_unsupported() or inodes_equal(path('src'), path('dst')) + + +@in_env +def test_hardlink_file_no_src(path): + with pytest.raises(OSError) as errinfo: library.python.fs.hardlink(path('src'), path('dst')) - assert errinfo.value.errno == errno.ENOENT - - -@in_env -def test_hardlink_file_exists(path): - mkfile(path('src'), 'SRC') - mkfile(path('dst'), 'DST') - with pytest.raises(OSError) as errinfo: + assert errinfo.value.errno == errno.ENOENT + + +@in_env +def test_hardlink_file_exists(path): + mkfile(path('src'), 'SRC') + mkfile(path('dst'), 'DST') + with pytest.raises(OSError) as errinfo: library.python.fs.hardlink(path('src'), path('dst')) - assert errinfo.value.errno == errno.EEXIST - assert os.path.isfile(path('src')) - assert os.path.isfile(path('dst')) - assert file_data(path('dst')) == 'DST' - assert inodes_unsupported() or not inodes_equal(path('src'), path('dst')) - - -@in_env -def test_hardlink_file_exists_dir(path): - mkfile(path('src'), 'SRC') - os.mkdir(path('dst')) - with pytest.raises(OSError) as errinfo: + assert errinfo.value.errno == errno.EEXIST + assert os.path.isfile(path('src')) + assert os.path.isfile(path('dst')) + assert file_data(path('dst')) == 'DST' + assert inodes_unsupported() or not inodes_equal(path('src'), path('dst')) + + +@in_env +def test_hardlink_file_exists_dir(path): + mkfile(path('src'), 'SRC') + os.mkdir(path('dst')) + with pytest.raises(OSError) as errinfo: library.python.fs.hardlink(path('src'), path('dst')) - assert errinfo.value.errno == errno.EEXIST - assert os.path.isfile(path('src')) - assert os.path.isdir(path('dst')) - assert not os.path.isfile(path('dst/src')) - - -@in_env -def test_hardlink_dir(path): - os.mkdir(path('src')) - mkfile(path('src/src_file')) - with pytest.raises(OSError) as errinfo: + assert errinfo.value.errno == errno.EEXIST + assert os.path.isfile(path('src')) + assert os.path.isdir(path('dst')) + assert not os.path.isfile(path('dst/src')) + + +@in_env +def test_hardlink_dir(path): + os.mkdir(path('src')) + mkfile(path('src/src_file')) + with pytest.raises(OSError) as errinfo: library.python.fs.hardlink(path('src'), path('dst')) - assert errinfo.value.errno in (errno.EPERM, errno.EACCES) - assert os.path.isdir(path('src')) - assert not os.path.isdir(path('dst')) - - + assert errinfo.value.errno in (errno.EPERM, errno.EACCES) + assert os.path.isdir(path('src')) + assert not os.path.isdir(path('dst')) + + @pytest.mark.skipif(library.python.windows.on_win(), reason='Symlinks disabled on Windows') -@in_env -def test_symlink_file(path): - mkfile(path('src'), 'SRC') +@in_env +def test_symlink_file(path): + mkfile(path('src'), 'SRC') library.python.fs.symlink(path('src'), path('dst')) - assert os.path.isfile(path('src')) - assert os.path.isfile(path('dst')) - assert os.path.islink(path('dst')) - assert file_data(path('dst')) == 'SRC' - - + assert os.path.isfile(path('src')) + assert os.path.isfile(path('dst')) + assert os.path.islink(path('dst')) + assert file_data(path('dst')) == 'SRC' + + @pytest.mark.skipif(library.python.windows.on_win(), reason='Symlinks disabled on Windows') -@in_env -def test_symlink_file_no_src(path): +@in_env +def test_symlink_file_no_src(path): library.python.fs.symlink(path('src'), path('dst')) - assert not os.path.isfile(path('src')) - assert not os.path.isfile(path('dst')) - assert os.path.islink(path('dst')) - - + assert not os.path.isfile(path('src')) + assert not os.path.isfile(path('dst')) + assert os.path.islink(path('dst')) + + @pytest.mark.skipif(library.python.windows.on_win(), reason='Symlinks disabled on Windows') -@in_env -def test_symlink_file_exists(path): - mkfile(path('src'), 'SRC') - mkfile(path('dst'), 'DST') - with pytest.raises(OSError) as errinfo: +@in_env +def test_symlink_file_exists(path): + mkfile(path('src'), 'SRC') + mkfile(path('dst'), 'DST') + with pytest.raises(OSError) as errinfo: library.python.fs.symlink(path('src'), path('dst')) - assert errinfo.value.errno == errno.EEXIST - assert os.path.isfile(path('src')) - assert os.path.isfile(path('dst')) - assert not os.path.islink(path('dst')) - assert file_data(path('dst')) == 'DST' - - + assert errinfo.value.errno == errno.EEXIST + assert os.path.isfile(path('src')) + assert os.path.isfile(path('dst')) + assert not os.path.islink(path('dst')) + assert file_data(path('dst')) == 'DST' + + @pytest.mark.skipif(library.python.windows.on_win(), reason='Symlinks disabled on Windows') -@in_env -def test_symlink_file_exists_dir(path): - mkfile(path('src'), 'SRC') - os.mkdir(path('dst')) - with pytest.raises(OSError) as errinfo: +@in_env +def test_symlink_file_exists_dir(path): + mkfile(path('src'), 'SRC') + os.mkdir(path('dst')) + with pytest.raises(OSError) as errinfo: library.python.fs.symlink(path('src'), path('dst')) - assert errinfo.value.errno == errno.EEXIST - assert os.path.isfile(path('src')) - assert os.path.isdir(path('dst')) - assert not os.path.islink(path('dst')) - assert not os.path.isfile(path('dst/src')) - - + assert errinfo.value.errno == errno.EEXIST + assert os.path.isfile(path('src')) + assert os.path.isdir(path('dst')) + assert not os.path.islink(path('dst')) + assert not os.path.isfile(path('dst/src')) + + @pytest.mark.skipif(library.python.windows.on_win(), reason='Symlinks disabled on Windows') -@in_env -def test_symlink_dir(path): - os.mkdir(path('src')) - mkfile(path('src/src_file')) +@in_env +def test_symlink_dir(path): + os.mkdir(path('src')) + mkfile(path('src/src_file')) library.python.fs.symlink(path('src'), path('dst')) - assert os.path.isdir(path('src')) - assert os.path.isdir(path('dst')) - assert os.path.islink(path('dst')) - assert os.path.isfile(path('dst/src_file')) - - + assert os.path.isdir(path('src')) + assert os.path.isdir(path('dst')) + assert os.path.islink(path('dst')) + assert os.path.isfile(path('dst/src_file')) + + @pytest.mark.skipif(library.python.windows.on_win(), reason='Symlinks disabled on Windows') -@in_env -def test_symlink_dir_no_src(path): +@in_env +def test_symlink_dir_no_src(path): library.python.fs.symlink(path('src'), path('dst')) - assert not os.path.isdir(path('src')) - assert not os.path.isdir(path('dst')) - assert os.path.islink(path('dst')) - - + assert not os.path.isdir(path('src')) + assert not os.path.isdir(path('dst')) + assert os.path.islink(path('dst')) + + @pytest.mark.skipif(library.python.windows.on_win(), reason='Symlinks disabled on Windows') -@in_env -def test_symlink_dir_exists(path): - os.mkdir(path('src')) - mkfile(path('src/src_file')) - os.mkdir(path('dst')) - with pytest.raises(OSError) as errinfo: +@in_env +def test_symlink_dir_exists(path): + os.mkdir(path('src')) + mkfile(path('src/src_file')) + os.mkdir(path('dst')) + with pytest.raises(OSError) as errinfo: library.python.fs.symlink(path('src'), path('dst')) - assert errinfo.value.errno == errno.EEXIST - assert os.path.isdir(path('src')) - assert os.path.isdir(path('dst')) - assert not os.path.islink(path('dst')) - assert not os.path.isfile(path('dst/src_file')) - - + assert errinfo.value.errno == errno.EEXIST + assert os.path.isdir(path('src')) + assert os.path.isdir(path('dst')) + assert not os.path.islink(path('dst')) + assert not os.path.isfile(path('dst/src_file')) + + @pytest.mark.skipif(library.python.windows.on_win(), reason='Symlinks disabled on Windows') -@in_env -def test_symlink_dir_exists_file(path): - os.mkdir(path('src')) - mkfile(path('src/src_file')) - mkfile(path('dst'), 'DST') - with pytest.raises(OSError) as errinfo: +@in_env +def test_symlink_dir_exists_file(path): + os.mkdir(path('src')) + mkfile(path('src/src_file')) + mkfile(path('dst'), 'DST') + with pytest.raises(OSError) as errinfo: library.python.fs.symlink(path('src'), path('dst')) - assert errinfo.value.errno == errno.EEXIST - assert os.path.isdir(path('src')) - assert os.path.isfile(path('dst')) - assert not os.path.islink(path('dst')) - - -@in_env -def test_hardlink_tree(path): - mktree_example(path, 'src') + assert errinfo.value.errno == errno.EEXIST + assert os.path.isdir(path('src')) + assert os.path.isfile(path('dst')) + assert not os.path.islink(path('dst')) + + +@in_env +def test_hardlink_tree(path): + mktree_example(path, 'src') library.python.fs.hardlink_tree(path('src'), path('dst')) - assert trees_equal(path('src'), path('dst')) - - -@in_env -def test_hardlink_tree_empty(path): - os.mkdir(path('src')) + assert trees_equal(path('src'), path('dst')) + + +@in_env +def test_hardlink_tree_empty(path): + os.mkdir(path('src')) library.python.fs.hardlink_tree(path('src'), path('dst')) - assert trees_equal(path('src'), path('dst')) - - -@in_env -def test_hardlink_tree_file(path): - mkfile(path('src'), 'SRC') + assert trees_equal(path('src'), path('dst')) + + +@in_env +def test_hardlink_tree_file(path): + mkfile(path('src'), 'SRC') library.python.fs.hardlink_tree(path('src'), path('dst')) - assert trees_equal(path('src'), path('dst')) - - -@in_env -def test_hardlink_tree_no_src(path): - with pytest.raises(OSError) as errinfo: + assert trees_equal(path('src'), path('dst')) + + +@in_env +def test_hardlink_tree_no_src(path): + with pytest.raises(OSError) as errinfo: library.python.fs.hardlink_tree(path('src'), path('dst')) - assert errinfo.value.errno == errno.ENOENT - - -@in_env -def test_hardlink_tree_exists(path): - mktree_example(path, 'src') - os.mkdir(path('dst_dir')) - with pytest.raises(OSError) as errinfo: + assert errinfo.value.errno == errno.ENOENT + + +@in_env +def test_hardlink_tree_exists(path): + mktree_example(path, 'src') + os.mkdir(path('dst_dir')) + with pytest.raises(OSError) as errinfo: library.python.fs.hardlink_tree(path('src'), path('dst_dir')) - assert errinfo.value.errno == errno.EEXIST - mkfile(path('dst_file'), 'DST') - with pytest.raises(OSError) as errinfo: + assert errinfo.value.errno == errno.EEXIST + mkfile(path('dst_file'), 'DST') + with pytest.raises(OSError) as errinfo: library.python.fs.hardlink_tree(path('src'), path('dst_file')) - assert errinfo.value.errno == errno.EEXIST - - -@in_env -def test_hardlink_tree_file_exists(path): - mkfile(path('src'), 'SRC') - os.mkdir(path('dst_dir')) - with pytest.raises(OSError) as errinfo: + assert errinfo.value.errno == errno.EEXIST + + +@in_env +def test_hardlink_tree_file_exists(path): + mkfile(path('src'), 'SRC') + os.mkdir(path('dst_dir')) + with pytest.raises(OSError) as errinfo: library.python.fs.hardlink_tree(path('src'), path('dst_dir')) - assert errinfo.value.errno == errno.EEXIST - mkfile(path('dst_file'), 'DST') - with pytest.raises(OSError) as errinfo: + assert errinfo.value.errno == errno.EEXIST + mkfile(path('dst_file'), 'DST') + with pytest.raises(OSError) as errinfo: library.python.fs.hardlink_tree(path('src'), path('dst_file')) - assert errinfo.value.errno == errno.EEXIST - - -@in_env -def test_copy_file(path): - mkfile(path('src'), 'SRC') + assert errinfo.value.errno == errno.EEXIST + + +@in_env +def test_copy_file(path): + mkfile(path('src'), 'SRC') library.python.fs.copy_file(path('src'), path('dst')) - assert os.path.isfile(path('src')) - assert os.path.isfile(path('dst')) - assert file_data(path('dst')) == 'SRC' - - -@in_env -def test_copy_file_no_src(path): - with pytest.raises(EnvironmentError): + assert os.path.isfile(path('src')) + assert os.path.isfile(path('dst')) + assert file_data(path('dst')) == 'SRC' + + +@in_env +def test_copy_file_no_src(path): + with pytest.raises(EnvironmentError): library.python.fs.copy_file(path('src'), path('dst')) - - -@in_env -def test_copy_file_exists(path): - mkfile(path('src'), 'SRC') - mkfile(path('dst'), 'DST') + + +@in_env +def test_copy_file_exists(path): + mkfile(path('src'), 'SRC') + mkfile(path('dst'), 'DST') library.python.fs.copy_file(path('src'), path('dst')) - assert os.path.isfile(path('src')) - assert os.path.isfile(path('dst')) - assert file_data(path('dst')) == 'SRC' - - -@in_env -def test_copy_file_exists_dir_empty(path): - mkfile(path('src'), 'SRC') - os.mkdir(path('dst')) - with pytest.raises(EnvironmentError): + assert os.path.isfile(path('src')) + assert os.path.isfile(path('dst')) + assert file_data(path('dst')) == 'SRC' + + +@in_env +def test_copy_file_exists_dir_empty(path): + mkfile(path('src'), 'SRC') + os.mkdir(path('dst')) + with pytest.raises(EnvironmentError): library.python.fs.copy_file(path('src'), path('dst')) - assert os.path.isfile(path('src')) - assert os.path.isdir(path('dst')) - assert not os.path.isfile(path('dst/src')) - - -@in_env -def test_copy_file_exists_dir_nonempty(path): - mkfile(path('src'), 'SRC') - os.mkdir(path('dst')) - mkfile(path('dst/dst_file')) - with pytest.raises(EnvironmentError): + assert os.path.isfile(path('src')) + assert os.path.isdir(path('dst')) + assert not os.path.isfile(path('dst/src')) + + +@in_env +def test_copy_file_exists_dir_nonempty(path): + mkfile(path('src'), 'SRC') + os.mkdir(path('dst')) + mkfile(path('dst/dst_file')) + with pytest.raises(EnvironmentError): library.python.fs.copy_file(path('src'), path('dst')) - assert os.path.isfile(path('src')) - assert os.path.isdir(path('dst')) - assert os.path.isfile(path('dst/dst_file')) - assert not os.path.isfile(path('dst/src')) - - -@in_env -def test_copy_tree(path): - mktree_example(path, 'src') + assert os.path.isfile(path('src')) + assert os.path.isdir(path('dst')) + assert os.path.isfile(path('dst/dst_file')) + assert not os.path.isfile(path('dst/src')) + + +@in_env +def test_copy_tree(path): + mktree_example(path, 'src') library.python.fs.copy_tree(path('src'), path('dst')) - assert trees_equal(path('src'), path('dst')) - - -@in_env -def test_copy_tree_empty(path): - os.mkdir(path('src')) + assert trees_equal(path('src'), path('dst')) + + +@in_env +def test_copy_tree_empty(path): + os.mkdir(path('src')) library.python.fs.copy_tree(path('src'), path('dst')) - assert trees_equal(path('src'), path('dst')) - - -@in_env -def test_copy_tree_file(path): - mkfile(path('src'), 'SRC') + assert trees_equal(path('src'), path('dst')) + + +@in_env +def test_copy_tree_file(path): + mkfile(path('src'), 'SRC') library.python.fs.copy_tree(path('src'), path('dst')) - assert trees_equal(path('src'), path('dst')) - - -@in_env -def test_copy_tree_no_src(path): - with pytest.raises(EnvironmentError): + assert trees_equal(path('src'), path('dst')) + + +@in_env +def test_copy_tree_no_src(path): + with pytest.raises(EnvironmentError): library.python.fs.copy_tree(path('src'), path('dst')) - - -@in_env -def test_copy_tree_exists(path): - mktree_example(path, 'src') - os.mkdir(path('dst_dir')) - with pytest.raises(EnvironmentError): + + +@in_env +def test_copy_tree_exists(path): + mktree_example(path, 'src') + os.mkdir(path('dst_dir')) + with pytest.raises(EnvironmentError): library.python.fs.copy_tree(path('src'), path('dst_dir')) - mkfile(path('dst_file'), 'DST') - with pytest.raises(EnvironmentError): + mkfile(path('dst_file'), 'DST') + with pytest.raises(EnvironmentError): library.python.fs.copy_tree(path('src'), path('dst_file')) - - -@in_env -def test_copy_tree_file_exists(path): - mkfile(path('src'), 'SRC') - os.mkdir(path('dst_dir')) - with pytest.raises(EnvironmentError): + + +@in_env +def test_copy_tree_file_exists(path): + mkfile(path('src'), 'SRC') + os.mkdir(path('dst_dir')) + with pytest.raises(EnvironmentError): library.python.fs.copy_tree(path('src'), path('dst_dir')) - mkfile(path('dst_file'), 'DST') + mkfile(path('dst_file'), 'DST') library.python.fs.copy_tree(path('src'), path('dst_file')) - assert trees_equal(path('src'), path('dst_file')) - - -@in_env -def test_read_file(path): - mkfile(path('src'), 'SRC') + assert trees_equal(path('src'), path('dst_file')) + + +@in_env +def test_read_file(path): + mkfile(path('src'), 'SRC') assert library.python.fs.read_file(path('src')).decode(library.python.strings.fs_encoding()) == 'SRC' assert library.python.fs.read_file(path('src'), binary=False) == 'SRC' - - -@in_env -def test_read_file_empty(path): - mkfile(path('src')) + + +@in_env +def test_read_file_empty(path): + mkfile(path('src')) assert library.python.fs.read_file(path('src')).decode(library.python.strings.fs_encoding()) == '' assert library.python.fs.read_file(path('src'), binary=False) == '' - - -@in_env -def test_read_file_multiline(path): - mkfile(path('src'), 'SRC line 1\nSRC line 2\n') + + +@in_env +def test_read_file_multiline(path): + mkfile(path('src'), 'SRC line 1\nSRC line 2\n') assert ( library.python.fs.read_file(path('src')).decode(library.python.strings.fs_encoding()) == 'SRC line 1\nSRC line 2\n' ) assert library.python.fs.read_file(path('src'), binary=False) == 'SRC line 1\nSRC line 2\n' - - -@in_env -def test_read_file_multiline_crlf(path): - mkfile(path('src'), 'SRC line 1\r\nSRC line 2\r\n') + + +@in_env +def test_read_file_multiline_crlf(path): + mkfile(path('src'), 'SRC line 1\r\nSRC line 2\r\n') assert ( library.python.fs.read_file(path('src')).decode(library.python.strings.fs_encoding()) == 'SRC line 1\r\nSRC line 2\r\n' ) if library.python.windows.on_win() or six.PY3: # universal newlines are by default in text mode in python3 assert library.python.fs.read_file(path('src'), binary=False) == 'SRC line 1\nSRC line 2\n' - else: + else: assert library.python.fs.read_file(path('src'), binary=False) == 'SRC line 1\r\nSRC line 2\r\n' - - -@in_env -def test_read_file_unicode(path): - s = u'АБВ' - mkfile(path('src'), s.encode('utf-8')) - mkfile(path('src_cp1251'), s.encode('cp1251')) + + +@in_env +def test_read_file_unicode(path): + s = u'АБВ' + mkfile(path('src'), s.encode('utf-8')) + mkfile(path('src_cp1251'), s.encode('cp1251')) assert library.python.fs.read_file_unicode(path('src')) == s assert library.python.fs.read_file_unicode(path('src_cp1251'), enc='cp1251') == s assert library.python.fs.read_file_unicode(path('src'), binary=False) == s assert library.python.fs.read_file_unicode(path('src_cp1251'), binary=False, enc='cp1251') == s - - -@in_env -def test_read_file_unicode_empty(path): - mkfile(path('src')) - mkfile(path('src_cp1251')) + + +@in_env +def test_read_file_unicode_empty(path): + mkfile(path('src')) + mkfile(path('src_cp1251')) assert library.python.fs.read_file_unicode(path('src')) == '' assert library.python.fs.read_file_unicode(path('src_cp1251'), enc='cp1251') == '' assert library.python.fs.read_file_unicode(path('src'), binary=False) == '' assert library.python.fs.read_file_unicode(path('src_cp1251'), binary=False, enc='cp1251') == '' - - -@in_env -def test_read_file_unicode_multiline(path): - s = u'АБВ\nИ еще\n' - mkfile(path('src'), s.encode('utf-8')) - mkfile(path('src_cp1251'), s.encode('cp1251')) + + +@in_env +def test_read_file_unicode_multiline(path): + s = u'АБВ\nИ еще\n' + mkfile(path('src'), s.encode('utf-8')) + mkfile(path('src_cp1251'), s.encode('cp1251')) assert library.python.fs.read_file_unicode(path('src')) == s assert library.python.fs.read_file_unicode(path('src_cp1251'), enc='cp1251') == s assert library.python.fs.read_file_unicode(path('src'), binary=False) == s assert library.python.fs.read_file_unicode(path('src_cp1251'), binary=False, enc='cp1251') == s - - -@in_env -def test_read_file_unicode_multiline_crlf(path): - s = u'АБВ\r\nИ еще\r\n' - mkfile(path('src'), s.encode('utf-8')) - mkfile(path('src_cp1251'), s.encode('cp1251')) + + +@in_env +def test_read_file_unicode_multiline_crlf(path): + s = u'АБВ\r\nИ еще\r\n' + mkfile(path('src'), s.encode('utf-8')) + mkfile(path('src_cp1251'), s.encode('cp1251')) assert library.python.fs.read_file_unicode(path('src')) == s assert library.python.fs.read_file_unicode(path('src_cp1251'), enc='cp1251') == s if library.python.windows.on_win() or six.PY3: # universal newlines are by default in text mode in python3 assert library.python.fs.read_file_unicode(path('src'), binary=False) == u'АБВ\nИ еще\n' assert library.python.fs.read_file_unicode(path('src_cp1251'), binary=False, enc='cp1251') == u'АБВ\nИ еще\n' - else: + else: assert library.python.fs.read_file_unicode(path('src'), binary=False) == s assert library.python.fs.read_file_unicode(path('src_cp1251'), binary=False, enc='cp1251') == s - - -@in_env -def test_write_file(path): + + +@in_env +def test_write_file(path): library.python.fs.write_file(path('src'), 'SRC') - assert file_data(path('src')) == 'SRC' + assert file_data(path('src')) == 'SRC' library.python.fs.write_file(path('src2'), 'SRC', binary=False) - assert file_data(path('src2')) == 'SRC' - - -@in_env -def test_write_file_empty(path): + assert file_data(path('src2')) == 'SRC' + + +@in_env +def test_write_file_empty(path): library.python.fs.write_file(path('src'), '') - assert file_data(path('src')) == '' + assert file_data(path('src')) == '' library.python.fs.write_file(path('src2'), '', binary=False) - assert file_data(path('src2')) == '' - - -@in_env -def test_write_file_multiline(path): + assert file_data(path('src2')) == '' + + +@in_env +def test_write_file_multiline(path): library.python.fs.write_file(path('src'), 'SRC line 1\nSRC line 2\n') - assert file_data(path('src')) == 'SRC line 1\nSRC line 2\n' + assert file_data(path('src')) == 'SRC line 1\nSRC line 2\n' library.python.fs.write_file(path('src2'), 'SRC line 1\nSRC line 2\n', binary=False) if library.python.windows.on_win(): - assert file_data(path('src2')) == 'SRC line 1\r\nSRC line 2\r\n' - else: - assert file_data(path('src2')) == 'SRC line 1\nSRC line 2\n' - - -@in_env -def test_write_file_multiline_crlf(path): + assert file_data(path('src2')) == 'SRC line 1\r\nSRC line 2\r\n' + else: + assert file_data(path('src2')) == 'SRC line 1\nSRC line 2\n' + + +@in_env +def test_write_file_multiline_crlf(path): library.python.fs.write_file(path('src'), 'SRC line 1\r\nSRC line 2\r\n') - assert file_data(path('src')) == 'SRC line 1\r\nSRC line 2\r\n' + assert file_data(path('src')) == 'SRC line 1\r\nSRC line 2\r\n' library.python.fs.write_file(path('src2'), 'SRC line 1\r\nSRC line 2\r\n', binary=False) if library.python.windows.on_win(): - assert file_data(path('src2')) == 'SRC line 1\r\r\nSRC line 2\r\r\n' - else: - assert file_data(path('src2')) == 'SRC line 1\r\nSRC line 2\r\n' - - -@in_env -def test_get_file_size(path): - mkfile(path('one.txt'), '22') + assert file_data(path('src2')) == 'SRC line 1\r\r\nSRC line 2\r\r\n' + else: + assert file_data(path('src2')) == 'SRC line 1\r\nSRC line 2\r\n' + + +@in_env +def test_get_file_size(path): + mkfile(path('one.txt'), '22') assert library.python.fs.get_file_size(path('one.txt')) == 2 -@in_env -def test_get_file_size_empty(path): - mkfile(path('one.txt')) +@in_env +def test_get_file_size_empty(path): + mkfile(path('one.txt')) assert library.python.fs.get_file_size(path('one.txt')) == 0 - - -@in_env -def test_get_tree_size(path): - os.makedirs(path('deeper')) - mkfile(path('one.txt'), '1') - mkfile(path('deeper/two.txt'), '22') + + +@in_env +def test_get_tree_size(path): + os.makedirs(path('deeper')) + mkfile(path('one.txt'), '1') + mkfile(path('deeper/two.txt'), '22') assert library.python.fs.get_tree_size(path('one.txt')) == 1 assert library.python.fs.get_tree_size(path('')) == 1 assert library.python.fs.get_tree_size(path(''), recursive=True) == 3 - - + + @pytest.mark.skipif(library.python.windows.on_win(), reason='Symlinks disabled on Windows') -@in_env -def test_get_tree_size_dangling_symlink(path): - os.makedirs(path('deeper')) - mkfile(path('one.txt'), '1') - mkfile(path('deeper/two.txt'), '22') - os.symlink(path('deeper/two.txt'), path("deeper/link.txt")) - os.remove(path('deeper/two.txt')) - # does not fail +@in_env +def test_get_tree_size_dangling_symlink(path): + os.makedirs(path('deeper')) + mkfile(path('one.txt'), '1') + mkfile(path('deeper/two.txt'), '22') + os.symlink(path('deeper/two.txt'), path("deeper/link.txt")) + os.remove(path('deeper/two.txt')) + # does not fail assert library.python.fs.get_tree_size(path(''), recursive=True) == 1 diff --git a/library/python/pytest/allure/ya.make b/library/python/pytest/allure/ya.make index cd1517f45d..ab3f449c7f 100644 --- a/library/python/pytest/allure/ya.make +++ b/library/python/pytest/allure/ya.make @@ -2,10 +2,10 @@ PY23_LIBRARY() OWNER(exprmntr) -PY_SRCS(conftest.py) - -PEERDIR( - contrib/python/pytest-allure-adaptor +PY_SRCS(conftest.py) + +PEERDIR( + contrib/python/pytest-allure-adaptor ) END() diff --git a/library/python/pytest/empty/ya.make b/library/python/pytest/empty/ya.make index 5d9e5771f7..8f0fa37e2a 100644 --- a/library/python/pytest/empty/ya.make +++ b/library/python/pytest/empty/ya.make @@ -1,12 +1,12 @@ LIBRARY() -OWNER( - g:yatool - dmitko -) +OWNER( + g:yatool + dmitko +) -SRCS( - main.c -) +SRCS( + main.c +) END() diff --git a/library/python/pytest/ya.make b/library/python/pytest/ya.make index d74715d981..060c92c313 100644 --- a/library/python/pytest/ya.make +++ b/library/python/pytest/ya.make @@ -1,9 +1,9 @@ PY23_LIBRARY() -OWNER( - g:yatool - dmitko -) +OWNER( + g:yatool + dmitko +) PY_SRCS( __init__.py diff --git a/library/python/pytest/yatest_tools.py b/library/python/pytest/yatest_tools.py index 9dc1ed6943..6b8b896394 100644 --- a/library/python/pytest/yatest_tools.py +++ b/library/python/pytest/yatest_tools.py @@ -233,10 +233,10 @@ def get_python_cmd(opts=None, use_huge=True, suite=None): return ["python"] if suite and not suite._use_arcadia_python: return ["python"] - if use_huge: - return ["$(PYTHON)/python"] - ymake_path = opts.ymake_bin if opts and getattr(opts, 'ymake_bin', None) else "$(YMAKE)/ymake" - return [ymake_path, "--python"] + if use_huge: + return ["$(PYTHON)/python"] + ymake_path = opts.ymake_bin if opts and getattr(opts, 'ymake_bin', None) else "$(YMAKE)/ymake" + return [ymake_path, "--python"] def normalize_name(name): diff --git a/library/python/reservoir_sampling/ya.make b/library/python/reservoir_sampling/ya.make index 12867ce8b1..24cac20157 100644 --- a/library/python/reservoir_sampling/ya.make +++ b/library/python/reservoir_sampling/ya.make @@ -5,6 +5,6 @@ OWNER( PY23_LIBRARY() -PY_SRCS(__init__.py) +PY_SRCS(__init__.py) END() diff --git a/library/python/resource/ut/lib/ya.make b/library/python/resource/ut/lib/ya.make index a0d7697e8d..693e388878 100644 --- a/library/python/resource/ut/lib/ya.make +++ b/library/python/resource/ut/lib/ya.make @@ -2,7 +2,7 @@ PY23_LIBRARY() OWNER(pg) -TEST_SRCS(test_simple.py) +TEST_SRCS(test_simple.py) PEERDIR( library/python/resource diff --git a/library/python/resource/ya.make b/library/python/resource/ya.make index 7306bd4c1b..989329fa4b 100644 --- a/library/python/resource/ya.make +++ b/library/python/resource/ya.make @@ -6,8 +6,8 @@ PEERDIR( contrib/python/six ) -PY_SRCS(__init__.py) +PY_SRCS(__init__.py) END() - -RECURSE_FOR_TESTS(ut) + +RECURSE_FOR_TESTS(ut) diff --git a/library/python/runtime_py3/main/ya.make b/library/python/runtime_py3/main/ya.make index 9ddf6cf912..f308a93b28 100644 --- a/library/python/runtime_py3/main/ya.make +++ b/library/python/runtime_py3/main/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( - pg - orivej -) +OWNER( + pg + orivej +) PEERDIR( contrib/tools/python3/src diff --git a/library/python/runtime_py3/test/traceback/ya.make b/library/python/runtime_py3/test/traceback/ya.make index bf269bb447..b61fe9550b 100644 --- a/library/python/runtime_py3/test/traceback/ya.make +++ b/library/python/runtime_py3/test/traceback/ya.make @@ -1,17 +1,17 @@ PY3_PROGRAM() -OWNER( - abodrov - borman -) +OWNER( + abodrov + borman +) PEERDIR( contrib/python/ipython ) PY_SRCS( - MAIN - __main__.py=main + MAIN + __main__.py=main crash.py mod/__init__.py ) diff --git a/library/python/runtime_py3/test/ya.make b/library/python/runtime_py3/test/ya.make index 5c0197e99c..4ec3db74f5 100644 --- a/library/python/runtime_py3/test/ya.make +++ b/library/python/runtime_py3/test/ya.make @@ -1,11 +1,11 @@ PY3TEST() -OWNER( - abodrov - borman +OWNER( + abodrov + borman ) -DEPENDS(library/python/runtime_py3/test/traceback) +DEPENDS(library/python/runtime_py3/test/traceback) PEERDIR( contrib/python/parameterized @@ -17,7 +17,7 @@ PY_SRCS( resources/__init__.py resources/submodule/__init__.py ) - + TEST_SRCS( test_metadata.py test_resources.py diff --git a/library/python/runtime_py3/ya.make b/library/python/runtime_py3/ya.make index 507ad14c40..fa5c11341a 100644 --- a/library/python/runtime_py3/ya.make +++ b/library/python/runtime_py3/ya.make @@ -1,10 +1,10 @@ PY3_LIBRARY() -OWNER( - borman - orivej - pg -) +OWNER( + borman + orivej + pg +) NO_WSHADOW() @@ -14,7 +14,7 @@ PEERDIR( library/cpp/resource ) -CFLAGS(-DCYTHON_REGISTER_ABCS=0) +CFLAGS(-DCYTHON_REGISTER_ABCS=0) NO_PYTHON_INCLUDES() diff --git a/library/python/strings/strings.py b/library/python/strings/strings.py index cb903be611..5bfddfe78a 100644 --- a/library/python/strings/strings.py +++ b/library/python/strings/strings.py @@ -1,17 +1,17 @@ -import locale -import logging +import locale +import logging import six -import sys +import sys import codecs - + import library.python.func - + logger = logging.getLogger(__name__) - + DEFAULT_ENCODING = 'utf-8' -ENCODING_ERRORS_POLICY = 'replace' - +ENCODING_ERRORS_POLICY = 'replace' + def left_strip(el, prefix): """ @@ -20,29 +20,29 @@ def left_strip(el, prefix): if el.startswith(prefix): return el[len(prefix):] return el - - -# Explicit to-text conversion + + +# Explicit to-text conversion # Chooses between str/unicode, i.e. six.binary_type/six.text_type -def to_basestring(value): +def to_basestring(value): if isinstance(value, (six.binary_type, six.text_type)): - return value - try: + return value + try: if six.PY2: return unicode(value) else: return str(value) - except UnicodeDecodeError: - try: - return str(value) - except UnicodeEncodeError: - return repr(value) -to_text = to_basestring - - + except UnicodeDecodeError: + try: + return str(value) + except UnicodeEncodeError: + return repr(value) +to_text = to_basestring + + def to_unicode(value, from_enc=DEFAULT_ENCODING): if isinstance(value, six.text_type): - return value + return value if isinstance(value, six.binary_type): if six.PY2: return unicode(value, from_enc, ENCODING_ERRORS_POLICY) @@ -51,23 +51,23 @@ def to_unicode(value, from_enc=DEFAULT_ENCODING): return six.text_type(value) -# Optional from_enc enables transcoding +# Optional from_enc enables transcoding def to_str(value, to_enc=DEFAULT_ENCODING, from_enc=None): if isinstance(value, six.binary_type): - if from_enc is None or to_enc == from_enc: - # Unknown input encoding or input and output encoding are the same - return value - value = to_unicode(value, from_enc=from_enc) + if from_enc is None or to_enc == from_enc: + # Unknown input encoding or input and output encoding are the same + return value + value = to_unicode(value, from_enc=from_enc) if isinstance(value, six.text_type): - return value.encode(to_enc, ENCODING_ERRORS_POLICY) + return value.encode(to_enc, ENCODING_ERRORS_POLICY) return six.binary_type(value) - - + + def _convert_deep(x, enc, convert, relaxed=True): - if x is None: - return None + if x is None: + return None if isinstance(x, (six.text_type, six.binary_type)): - return convert(x, enc) + return convert(x, enc) if isinstance(x, dict): return {convert(k, enc): _convert_deep(v, enc, convert, relaxed) for k, v in six.iteritems(x)} if isinstance(x, list): @@ -82,15 +82,15 @@ def _convert_deep(x, enc, convert, relaxed=True): def unicodize_deep(x, enc=DEFAULT_ENCODING, relaxed=True): return _convert_deep(x, enc, to_unicode, relaxed) - - + + def stringize_deep(x, enc=DEFAULT_ENCODING, relaxed=True): return _convert_deep(x, enc, to_str, relaxed) - - + + @library.python.func.memoize() -def locale_encoding(): - try: +def locale_encoding(): + try: loc = locale.getdefaultlocale()[1] if loc: codecs.lookup(loc) @@ -98,17 +98,17 @@ def locale_encoding(): except LookupError as e: logger.debug('Cannot get system locale: %s', e) return None - except ValueError as e: + except ValueError as e: logger.warn('Cannot get system locale: %s', e) - return None - - -def fs_encoding(): - return sys.getfilesystemencoding() - - -def guess_default_encoding(): - enc = locale_encoding() + return None + + +def fs_encoding(): + return sys.getfilesystemencoding() + + +def guess_default_encoding(): + enc = locale_encoding() return enc if enc else DEFAULT_ENCODING diff --git a/library/python/strings/ut/test_strings.py b/library/python/strings/ut/test_strings.py index 0ec4fb5d79..dd0c694ee1 100644 --- a/library/python/strings/ut/test_strings.py +++ b/library/python/strings/ut/test_strings.py @@ -1,37 +1,37 @@ -# coding=utf-8 - -import pytest +# coding=utf-8 + +import pytest import six - + import library.python.strings - - -class Convertible(object): - text = u'текст' - text_utf8 = text.encode('utf-8') - - def __unicode__(self): - return self.text - - def __str__(self): - return self.text_utf8 - - -class ConvertibleToUnicodeOnly(Convertible): - def __str__(self): - return self.text.encode('ascii') - - -class ConvertibleToStrOnly(Convertible): - def __unicode__(self): - return self.text_utf8.decode('ascii') - - -class NonConvertible(ConvertibleToUnicodeOnly, ConvertibleToStrOnly): - pass - - -def test_to_basestring(): + + +class Convertible(object): + text = u'текст' + text_utf8 = text.encode('utf-8') + + def __unicode__(self): + return self.text + + def __str__(self): + return self.text_utf8 + + +class ConvertibleToUnicodeOnly(Convertible): + def __str__(self): + return self.text.encode('ascii') + + +class ConvertibleToStrOnly(Convertible): + def __unicode__(self): + return self.text_utf8.decode('ascii') + + +class NonConvertible(ConvertibleToUnicodeOnly, ConvertibleToStrOnly): + pass + + +def test_to_basestring(): assert library.python.strings.to_basestring('str') == 'str' assert library.python.strings.to_basestring(u'юникод') == u'юникод' if six.PY2: # __str__ should return str not bytes in Python3 @@ -39,9 +39,9 @@ def test_to_basestring(): assert library.python.strings.to_basestring(ConvertibleToUnicodeOnly()) == Convertible.text assert library.python.strings.to_basestring(ConvertibleToStrOnly()) == Convertible.text_utf8 assert library.python.strings.to_basestring(NonConvertible()) - - -def test_to_unicode(): + + +def test_to_unicode(): assert library.python.strings.to_unicode(u'юникод') == u'юникод' assert library.python.strings.to_unicode('str') == u'str' assert library.python.strings.to_unicode(u'строка'.encode('utf-8')) == u'строка' @@ -53,14 +53,14 @@ def test_to_unicode(): library.python.strings.to_unicode(ConvertibleToStrOnly()) with pytest.raises(UnicodeDecodeError): library.python.strings.to_unicode(NonConvertible()) - - -def test_to_unicode_errors_replace(): + + +def test_to_unicode_errors_replace(): assert library.python.strings.to_unicode(u'abcабв'.encode('utf-8'), 'ascii') assert library.python.strings.to_unicode(u'абв'.encode('utf-8'), 'ascii') - - -def test_to_str(): + + +def test_to_str(): assert library.python.strings.to_str('str') == 'str' if six.PY2 else b'str' assert library.python.strings.to_str(u'unicode') == 'unicode' if six.PY2 else b'unicode' assert library.python.strings.to_str(u'юникод') == u'юникод'.encode('utf-8') @@ -72,134 +72,134 @@ def test_to_str(): assert library.python.strings.to_str(ConvertibleToStrOnly()) == Convertible.text_utf8 with pytest.raises(UnicodeEncodeError): library.python.strings.to_str(NonConvertible()) - - -def test_to_str_errors_replace(): + + +def test_to_str_errors_replace(): assert library.python.strings.to_str(u'abcабв', 'ascii') assert library.python.strings.to_str(u'абв', 'ascii') - - -def test_to_str_transcode(): + + +def test_to_str_transcode(): assert library.python.strings.to_str('str', from_enc='ascii') == 'str' if six.PY2 else b'str' assert library.python.strings.to_str('str', from_enc='utf-8') == 'str' if six.PY2 else b'str' - + assert library.python.strings.to_str(u'юникод'.encode('utf-8'), from_enc='utf-8') == u'юникод'.encode('utf-8') assert library.python.strings.to_str(u'юникод'.encode('utf-8'), to_enc='utf-8', from_enc='utf-8') == u'юникод'.encode('utf-8') assert library.python.strings.to_str(u'юникод'.encode('utf-8'), to_enc='cp1251', from_enc='utf-8') == u'юникод'.encode('cp1251') - + assert library.python.strings.to_str(u'юникод'.encode('cp1251'), from_enc='cp1251') == u'юникод'.encode('utf-8') assert library.python.strings.to_str(u'юникод'.encode('cp1251'), to_enc='cp1251', from_enc='cp1251') == u'юникод'.encode('cp1251') assert library.python.strings.to_str(u'юникод'.encode('cp1251'), to_enc='utf-8', from_enc='cp1251') == u'юникод'.encode('utf-8') - + assert library.python.strings.to_str(u'юникод'.encode('koi8-r'), from_enc='koi8-r') == u'юникод'.encode('utf-8') assert library.python.strings.to_str(u'юникод'.encode('koi8-r'), to_enc='koi8-r', from_enc='koi8-r') == u'юникод'.encode('koi8-r') assert library.python.strings.to_str(u'юникод'.encode('koi8-r'), to_enc='cp1251', from_enc='koi8-r') == u'юникод'.encode('cp1251') - - -def test_to_str_transcode_wrong(): + + +def test_to_str_transcode_wrong(): assert library.python.strings.to_str(u'юникод'.encode('utf-8'), from_enc='cp1251') assert library.python.strings.to_str(u'юникод'.encode('cp1251'), from_enc='utf-8') - - -def test_to_str_transcode_disabled(): - # No transcoding enabled, set from_enc to enable + + +def test_to_str_transcode_disabled(): + # No transcoding enabled, set from_enc to enable assert library.python.strings.to_str(u'юникод'.encode('utf-8'), to_enc='utf-8') == u'юникод'.encode('utf-8') assert library.python.strings.to_str(u'юникод'.encode('utf-8'), to_enc='cp1251') == u'юникод'.encode('utf-8') assert library.python.strings.to_str(u'юникод'.encode('cp1251'), to_enc='utf-8') == u'юникод'.encode('cp1251') assert library.python.strings.to_str(u'юникод'.encode('cp1251'), to_enc='cp1251') == u'юникод'.encode('cp1251') assert library.python.strings.to_str(u'юникод'.encode('cp1251'), to_enc='koi8-r') == u'юникод'.encode('cp1251') assert library.python.strings.to_str(u'юникод'.encode('koi8-r'), to_enc='cp1251') == u'юникод'.encode('koi8-r') - - -def test_stringize_deep(): + + +def test_stringize_deep(): assert library.python.strings.stringize_deep({ - 'key 1': 'value 1', - u'ключ 2': u'значение 2', + 'key 1': 'value 1', + u'ключ 2': u'значение 2', 'list': [u'ключ 2', 'key 1', (u'к', 2)] - }) == { + }) == { 'key 1' if six.PY2 else b'key 1': 'value 1' if six.PY2 else b'value 1', - u'ключ 2'.encode('utf-8'): u'значение 2'.encode('utf-8'), + u'ключ 2'.encode('utf-8'): u'значение 2'.encode('utf-8'), 'list' if six.PY2 else b'list': [u'ключ 2'.encode('utf-8'), 'key 1' if six.PY2 else b'key 1', (u'к'.encode('utf-8'), 2)] - } - - -def test_stringize_deep_doesnt_transcode(): + } + + +def test_stringize_deep_doesnt_transcode(): assert library.python.strings.stringize_deep({ - u'ключ 1'.encode('utf-8'): u'значение 1'.encode('utf-8'), - u'ключ 2'.encode('cp1251'): u'значение 2'.encode('cp1251'), - }) == { - u'ключ 1'.encode('utf-8'): u'значение 1'.encode('utf-8'), - u'ключ 2'.encode('cp1251'): u'значение 2'.encode('cp1251'), - } - - -def test_stringize_deep_nested(): + u'ключ 1'.encode('utf-8'): u'значение 1'.encode('utf-8'), + u'ключ 2'.encode('cp1251'): u'значение 2'.encode('cp1251'), + }) == { + u'ключ 1'.encode('utf-8'): u'значение 1'.encode('utf-8'), + u'ключ 2'.encode('cp1251'): u'значение 2'.encode('cp1251'), + } + + +def test_stringize_deep_nested(): assert library.python.strings.stringize_deep({ - 'key 1': 'value 1', - u'ключ 2': { - 'subkey 1': 'value 1', - u'подключ 2': u'value 2', - }, - }) == { + 'key 1': 'value 1', + u'ключ 2': { + 'subkey 1': 'value 1', + u'подключ 2': u'value 2', + }, + }) == { 'key 1' if six.PY2 else b'key 1': 'value 1' if six.PY2 else b'value 1', - u'ключ 2'.encode('utf-8'): { + u'ключ 2'.encode('utf-8'): { 'subkey 1' if six.PY2 else b'subkey 1': 'value 1' if six.PY2 else b'value 1', - u'подключ 2'.encode('utf-8'): u'value 2'.encode('utf-8'), - }, - } - - -def test_stringize_deep_plain(): + u'подключ 2'.encode('utf-8'): u'value 2'.encode('utf-8'), + }, + } + + +def test_stringize_deep_plain(): assert library.python.strings.stringize_deep('str') == 'str' if six.PY2 else b'str' assert library.python.strings.stringize_deep(u'юникод') == u'юникод'.encode('utf-8') assert library.python.strings.stringize_deep(u'юникод'.encode('utf-8')) == u'юникод'.encode('utf-8') - - -def test_stringize_deep_nonstr(): - with pytest.raises(TypeError): + + +def test_stringize_deep_nonstr(): + with pytest.raises(TypeError): library.python.strings.stringize_deep(Convertible(), relaxed=False) x = Convertible() assert x == library.python.strings.stringize_deep(x) - - -def test_unicodize_deep(): + + +def test_unicodize_deep(): assert library.python.strings.unicodize_deep({ - 'key 1': 'value 1', - u'ключ 2': u'значение 2', - u'ключ 3'.encode('utf-8'): u'значение 3'.encode('utf-8'), - }) == { - u'key 1': u'value 1', - u'ключ 2': u'значение 2', - u'ключ 3': u'значение 3', - } - - -def test_unicodize_deep_nested(): + 'key 1': 'value 1', + u'ключ 2': u'значение 2', + u'ключ 3'.encode('utf-8'): u'значение 3'.encode('utf-8'), + }) == { + u'key 1': u'value 1', + u'ключ 2': u'значение 2', + u'ключ 3': u'значение 3', + } + + +def test_unicodize_deep_nested(): assert library.python.strings.unicodize_deep({ - 'key 1': 'value 1', - u'ключ 2': { - 'subkey 1': 'value 1', - u'подключ 2': u'значение 2', - u'подключ 3'.encode('utf-8'): u'значение 3'.encode('utf-8'), - }, - }) == { - u'key 1': u'value 1', - u'ключ 2': { - u'subkey 1': u'value 1', - u'подключ 2': u'значение 2', - u'подключ 3': u'значение 3', - }, - } - - -def test_unicodize_deep_plain(): + 'key 1': 'value 1', + u'ключ 2': { + 'subkey 1': 'value 1', + u'подключ 2': u'значение 2', + u'подключ 3'.encode('utf-8'): u'значение 3'.encode('utf-8'), + }, + }) == { + u'key 1': u'value 1', + u'ключ 2': { + u'subkey 1': u'value 1', + u'подключ 2': u'значение 2', + u'подключ 3': u'значение 3', + }, + } + + +def test_unicodize_deep_plain(): assert library.python.strings.unicodize_deep('str') == u'str' assert library.python.strings.unicodize_deep(u'юникод') == u'юникод' assert library.python.strings.unicodize_deep(u'юникод'.encode('utf-8')) == u'юникод' - - -def test_unicodize_deep_nonstr(): - with pytest.raises(TypeError): + + +def test_unicodize_deep_nonstr(): + with pytest.raises(TypeError): library.python.strings.unicodize_deep(Convertible(), relaxed=False) x = Convertible() assert x == library.python.strings.stringize_deep(x) diff --git a/library/python/strings/ut/ya.make b/library/python/strings/ut/ya.make index adbeb9a054..dfacb226c7 100644 --- a/library/python/strings/ut/ya.make +++ b/library/python/strings/ut/ya.make @@ -2,7 +2,7 @@ OWNER(g:yatool) PY23_TEST() -TEST_SRCS(test_strings.py) +TEST_SRCS(test_strings.py) PEERDIR( library/python/strings diff --git a/library/python/strings/ya.make b/library/python/strings/ya.make index eee89ae7dc..7e0b033717 100644 --- a/library/python/strings/ya.make +++ b/library/python/strings/ya.make @@ -8,9 +8,9 @@ PY_SRCS( strings.py ) -PEERDIR( - library/python/func +PEERDIR( + library/python/func contrib/python/six -) +) END() diff --git a/library/python/symbols/python/ut/ya.make b/library/python/symbols/python/ut/ya.make index ba20bf0237..2849e01b1e 100644 --- a/library/python/symbols/python/ut/ya.make +++ b/library/python/symbols/python/ut/ya.make @@ -2,14 +2,14 @@ PY23_LIBRARY() OWNER(orivej) -TEST_SRCS(test_ctypes.py) +TEST_SRCS(test_ctypes.py) PEERDIR( library/python/symbols/python ) END() - + RECURSE_FOR_TESTS( py2 py3 diff --git a/library/python/symbols/python/ya.make b/library/python/symbols/python/ya.make index 7762f87592..6bfd54f8bc 100644 --- a/library/python/symbols/python/ya.make +++ b/library/python/symbols/python/ya.make @@ -11,5 +11,5 @@ SRCS( ) END() - -RECURSE_FOR_TESTS(ut) + +RECURSE_FOR_TESTS(ut) diff --git a/library/python/testing/import_test/ya.make b/library/python/testing/import_test/ya.make index 68b147a00c..fae36ffe8f 100644 --- a/library/python/testing/import_test/ya.make +++ b/library/python/testing/import_test/ya.make @@ -1,7 +1,7 @@ -OWNER( +OWNER( g:yatest - exprmntr -) + exprmntr +) PY23_LIBRARY() diff --git a/library/python/testing/recipe/ya.make b/library/python/testing/recipe/ya.make index d6fa84a873..dd323aa245 100644 --- a/library/python/testing/recipe/ya.make +++ b/library/python/testing/recipe/ya.make @@ -1,7 +1,7 @@ -OWNER( - exprmntr +OWNER( + exprmntr g:yatest -) +) PY23_LIBRARY() diff --git a/library/python/testing/yatest_common/yatest/common/canonical.py b/library/python/testing/yatest_common/yatest/common/canonical.py index 443a5106ea..b6a136d3e9 100644 --- a/library/python/testing/yatest_common/yatest/common/canonical.py +++ b/library/python/testing/yatest_common/yatest/common/canonical.py @@ -12,22 +12,22 @@ from . import path yatest_logger = logging.getLogger("ya.test") -def _copy(src, dst, universal_lines=False): - if universal_lines: - with open(dst, "wb") as f: +def _copy(src, dst, universal_lines=False): + if universal_lines: + with open(dst, "wb") as f: for line in open(src, "rbU"): - f.write(line) - return - shutil.copy(src, dst) - - + f.write(line) + return + shutil.copy(src, dst) + + def canonical_file(path, diff_tool=None, local=False, universal_lines=False, diff_file_name=None, diff_tool_timeout=None): """ Create canonical file that can be returned from a test :param path: path to the file :param diff_tool: custom diff tool to use for comparison with the canonical one, if None - default will be used :param local: save file locally, otherwise move to sandbox - :param universal_lines: normalize EOL + :param universal_lines: normalize EOL :param diff_tool_timeout: timeout for running diff tool :return: object that can be canonized """ @@ -36,7 +36,7 @@ def canonical_file(path, diff_tool=None, local=False, universal_lines=False, dif tempdir = tempfile.mkdtemp(prefix="canon_tmp", dir=runtime.build_path()) safe_path = os.path.join(tempdir, os.path.basename(abs_path)) # if the created file is in output_path, we copy it, so that it will be available when the tests finishes - _copy(path, safe_path, universal_lines=universal_lines) + _copy(path, safe_path, universal_lines=universal_lines) if diff_tool: if not isinstance(diff_tool, six.string_types): try: # check if iterable diff --git a/library/python/testing/yatest_common/yatest/common/network.py b/library/python/testing/yatest_common/yatest/common/network.py index 291aa49151..37bcb1b8e0 100644 --- a/library/python/testing/yatest_common/yatest/common/network.py +++ b/library/python/testing/yatest_common/yatest/common/network.py @@ -1,4 +1,4 @@ -# coding=utf-8 +# coding=utf-8 import os import errno diff --git a/library/python/testing/yatest_common/yatest/common/path.py b/library/python/testing/yatest_common/yatest/common/path.py index 079770605e..6fed7dda8a 100644 --- a/library/python/testing/yatest_common/yatest/common/path.py +++ b/library/python/testing/yatest_common/yatest/common/path.py @@ -1,4 +1,4 @@ -# coding=utf-8 +# coding=utf-8 import errno import os diff --git a/library/python/testing/yatest_lib/ya.make b/library/python/testing/yatest_lib/ya.make index 7453e5b665..342bae82ba 100644 --- a/library/python/testing/yatest_lib/ya.make +++ b/library/python/testing/yatest_lib/ya.make @@ -3,8 +3,8 @@ OWNER(g:yatest) PY23_LIBRARY() PY_SRCS( - NAMESPACE - yatest_lib + NAMESPACE + yatest_lib external.py test_splitter.py tools.py diff --git a/library/python/windows/__init__.py b/library/python/windows/__init__.py index 2e426f2bd8..62861b3309 100644 --- a/library/python/windows/__init__.py +++ b/library/python/windows/__init__.py @@ -1,290 +1,290 @@ # coding: utf-8 -import os +import os import stat import sys import shutil import logging - + from six import reraise import library.python.func import library.python.strings - + logger = logging.getLogger(__name__) - -ERRORS = { - 'SUCCESS': 0, + +ERRORS = { + 'SUCCESS': 0, 'PATH_NOT_FOUND': 3, 'ACCESS_DENIED': 5, 'SHARING_VIOLATION': 32, - 'INSUFFICIENT_BUFFER': 122, - 'DIR_NOT_EMPTY': 145, -} - + 'INSUFFICIENT_BUFFER': 122, + 'DIR_NOT_EMPTY': 145, +} + RETRIABLE_FILE_ERRORS = (ERRORS['ACCESS_DENIED'], ERRORS['SHARING_VIOLATION']) RETRIABLE_DIR_ERRORS = (ERRORS['ACCESS_DENIED'], ERRORS['DIR_NOT_EMPTY'], ERRORS['SHARING_VIOLATION']) - -# Check if on Windows + +# Check if on Windows @library.python.func.lazy -def on_win(): - return os.name == 'nt' - - -class NotOnWindowsError(RuntimeError): - def __init__(self, message): - super(NotOnWindowsError, self).__init__(message) - - -class DisabledOnWindowsError(RuntimeError): - def __init__(self, message): - super(DisabledOnWindowsError, self).__init__(message) - - -class NoCTypesError(RuntimeError): - def __init__(self, message): - super(NoCTypesError, self).__init__(message) - - -# Decorator for Windows-only functions -def win_only(f): - def f_wrapped(*args, **kwargs): - if not on_win(): - raise NotOnWindowsError('Windows-only function is called, but platform is not Windows') - return f(*args, **kwargs) - - return f_wrapped - - -# Decorator for functions disabled on Windows -def win_disabled(f): - def f_wrapped(*args, **kwargs): - if on_win(): - run_disabled() - return f(*args, **kwargs) - - return f_wrapped - - -def errorfix(f): - if not on_win(): - return f - - def f_wrapped(*args, **kwargs): - try: - return f(*args, **kwargs) +def on_win(): + return os.name == 'nt' + + +class NotOnWindowsError(RuntimeError): + def __init__(self, message): + super(NotOnWindowsError, self).__init__(message) + + +class DisabledOnWindowsError(RuntimeError): + def __init__(self, message): + super(DisabledOnWindowsError, self).__init__(message) + + +class NoCTypesError(RuntimeError): + def __init__(self, message): + super(NoCTypesError, self).__init__(message) + + +# Decorator for Windows-only functions +def win_only(f): + def f_wrapped(*args, **kwargs): + if not on_win(): + raise NotOnWindowsError('Windows-only function is called, but platform is not Windows') + return f(*args, **kwargs) + + return f_wrapped + + +# Decorator for functions disabled on Windows +def win_disabled(f): + def f_wrapped(*args, **kwargs): + if on_win(): + run_disabled() + return f(*args, **kwargs) + + return f_wrapped + + +def errorfix(f): + if not on_win(): + return f + + def f_wrapped(*args, **kwargs): + try: + return f(*args, **kwargs) except WindowsError: tp, value, tb = sys.exc_info() fix_error(value) reraise(tp, value, tb) - - return f_wrapped - - -# Decorator for diehard wrapper -# On Windows platform retries to run function while specific WindowsError is thrown -# On non-Windows platforms fallbacks to function itself -def diehard(winerrors, tries=100, delay=1): - def wrap(f): - if not on_win(): - return f - - return lambda *args, **kwargs: run_diehard(f, winerrors, tries, delay, *args, **kwargs) - - return wrap - - -if on_win(): - import msvcrt - import time - + + return f_wrapped + + +# Decorator for diehard wrapper +# On Windows platform retries to run function while specific WindowsError is thrown +# On non-Windows platforms fallbacks to function itself +def diehard(winerrors, tries=100, delay=1): + def wrap(f): + if not on_win(): + return f + + return lambda *args, **kwargs: run_diehard(f, winerrors, tries, delay, *args, **kwargs) + + return wrap + + +if on_win(): + import msvcrt + import time + import library.python.strings - - _has_ctypes = True - try: - import ctypes + + _has_ctypes = True + try: + import ctypes from ctypes import wintypes - except ImportError: - _has_ctypes = False - - _INVALID_HANDLE_VALUE = -1 - - _MOVEFILE_REPLACE_EXISTING = 0x1 - _MOVEFILE_WRITE_THROUGH = 0x8 - - _SEM_FAILCRITICALERRORS = 0x1 - _SEM_NOGPFAULTERRORBOX = 0x2 - _SEM_NOALIGNMENTFAULTEXCEPT = 0x4 - _SEM_NOOPENFILEERRORBOX = 0x8 - - _SYMBOLIC_LINK_FLAG_DIRECTORY = 0x1 - - _CREATE_NO_WINDOW = 0x8000000 - - _ATOMIC_RENAME_FILE_TRANSACTION_DEFAULT_TIMEOUT = 1000 - + except ImportError: + _has_ctypes = False + + _INVALID_HANDLE_VALUE = -1 + + _MOVEFILE_REPLACE_EXISTING = 0x1 + _MOVEFILE_WRITE_THROUGH = 0x8 + + _SEM_FAILCRITICALERRORS = 0x1 + _SEM_NOGPFAULTERRORBOX = 0x2 + _SEM_NOALIGNMENTFAULTEXCEPT = 0x4 + _SEM_NOOPENFILEERRORBOX = 0x8 + + _SYMBOLIC_LINK_FLAG_DIRECTORY = 0x1 + + _CREATE_NO_WINDOW = 0x8000000 + + _ATOMIC_RENAME_FILE_TRANSACTION_DEFAULT_TIMEOUT = 1000 + _HANDLE_FLAG_INHERIT = 0x1 - @win_only - def require_ctypes(f): - def f_wrapped(*args, **kwargs): - if not _has_ctypes: - raise NoCTypesError('No ctypes found') - return f(*args, **kwargs) - - return f_wrapped - - # Run function in diehard mode (see diehard decorator commentary) - @win_only - def run_diehard(f, winerrors, tries, delay, *args, **kwargs): - if isinstance(winerrors, int): - winerrors = (winerrors,) + @win_only + def require_ctypes(f): + def f_wrapped(*args, **kwargs): + if not _has_ctypes: + raise NoCTypesError('No ctypes found') + return f(*args, **kwargs) + + return f_wrapped + + # Run function in diehard mode (see diehard decorator commentary) + @win_only + def run_diehard(f, winerrors, tries, delay, *args, **kwargs): + if isinstance(winerrors, int): + winerrors = (winerrors,) ei = None - for t in xrange(tries): - if t: + for t in xrange(tries): + if t: logger.debug('Diehard [errs %s]: try #%d in %s', ','.join(str(x) for x in winerrors), t, f) - try: - return f(*args, **kwargs) - except WindowsError as e: - if e.winerror not in winerrors: - raise + try: + return f(*args, **kwargs) + except WindowsError as e: + if e.winerror not in winerrors: + raise ei = sys.exc_info() - time.sleep(delay) + time.sleep(delay) reraise(ei[0], ei[1], ei[2]) - - # Placeholder for disabled functions - @win_only - def run_disabled(*args, **kwargs): - raise DisabledOnWindowsError('Function called is disabled on Windows') - - class CustomWinError(WindowsError): - def __init__(self, winerror, message='', filename=None): - super(CustomWinError, self).__init__(winerror, message) - self.message = message - self.strerror = self.message if self.message else format_error(self.windows_error) - self.filename = filename - self.utf8 = True - - @win_only - def unicode_path(path): + + # Placeholder for disabled functions + @win_only + def run_disabled(*args, **kwargs): + raise DisabledOnWindowsError('Function called is disabled on Windows') + + class CustomWinError(WindowsError): + def __init__(self, winerror, message='', filename=None): + super(CustomWinError, self).__init__(winerror, message) + self.message = message + self.strerror = self.message if self.message else format_error(self.windows_error) + self.filename = filename + self.utf8 = True + + @win_only + def unicode_path(path): return library.python.strings.to_unicode(path, library.python.strings.fs_encoding()) - - @win_only - @require_ctypes - def format_error(error): - if isinstance(error, WindowsError): - error = error.winerror - if not isinstance(error, int): - return 'Unknown' - return ctypes.FormatError(error) - - @win_only - def fix_error(windows_error): - if not windows_error.strerror: - windows_error.strerror = format_error(windows_error) - transcode_error(windows_error) - - @win_only - def transcode_error(windows_error, to_enc='utf-8'): + + @win_only + @require_ctypes + def format_error(error): + if isinstance(error, WindowsError): + error = error.winerror + if not isinstance(error, int): + return 'Unknown' + return ctypes.FormatError(error) + + @win_only + def fix_error(windows_error): + if not windows_error.strerror: + windows_error.strerror = format_error(windows_error) + transcode_error(windows_error) + + @win_only + def transcode_error(windows_error, to_enc='utf-8'): from_enc = 'utf-8' if getattr(windows_error, 'utf8', False) else library.python.strings.guess_default_encoding() - if from_enc != to_enc: + if from_enc != to_enc: windows_error.strerror = library.python.strings.to_str(windows_error.strerror, to_enc=to_enc, from_enc=from_enc) - setattr(windows_error, 'utf8', to_enc == 'utf-8') - - class Transaction(object): - def __init__(self, timeout=None, description=''): - self.timeout = timeout - self.description = description - - @require_ctypes - def __enter__(self): - self._handle = ctypes.windll.ktmw32.CreateTransaction(None, 0, 0, 0, 0, self.timeout, self.description) - if self._handle == _INVALID_HANDLE_VALUE: - raise ctypes.WinError() - return self._handle - - @require_ctypes - def __exit__(self, t, v, tb): - try: - if not ctypes.windll.ktmw32.CommitTransaction(self._handle): - raise ctypes.WinError() - finally: - ctypes.windll.kernel32.CloseHandle(self._handle) - - @win_only - def file_handle(f): - return msvcrt.get_osfhandle(f.fileno()) - + setattr(windows_error, 'utf8', to_enc == 'utf-8') + + class Transaction(object): + def __init__(self, timeout=None, description=''): + self.timeout = timeout + self.description = description + + @require_ctypes + def __enter__(self): + self._handle = ctypes.windll.ktmw32.CreateTransaction(None, 0, 0, 0, 0, self.timeout, self.description) + if self._handle == _INVALID_HANDLE_VALUE: + raise ctypes.WinError() + return self._handle + + @require_ctypes + def __exit__(self, t, v, tb): + try: + if not ctypes.windll.ktmw32.CommitTransaction(self._handle): + raise ctypes.WinError() + finally: + ctypes.windll.kernel32.CloseHandle(self._handle) + + @win_only + def file_handle(f): + return msvcrt.get_osfhandle(f.fileno()) + # https://www.python.org/dev/peps/pep-0446/ # http://mihalop.blogspot.ru/2014/05/python-subprocess-and-file-descriptors.html @require_ctypes - @win_only + @win_only def open_file(*args, **kwargs): f = open(*args, **kwargs) ctypes.windll.kernel32.SetHandleInformation(file_handle(f), _HANDLE_FLAG_INHERIT, 0) return f @win_only - @require_ctypes - def replace_file(src, dst): - if not ctypes.windll.kernel32.MoveFileExW(unicode_path(src), unicode_path(dst), _MOVEFILE_REPLACE_EXISTING | _MOVEFILE_WRITE_THROUGH): - raise ctypes.WinError() - - @win_only - @require_ctypes - def replace_file_across_devices(src, dst): + @require_ctypes + def replace_file(src, dst): + if not ctypes.windll.kernel32.MoveFileExW(unicode_path(src), unicode_path(dst), _MOVEFILE_REPLACE_EXISTING | _MOVEFILE_WRITE_THROUGH): + raise ctypes.WinError() + + @win_only + @require_ctypes + def replace_file_across_devices(src, dst): with Transaction(timeout=_ATOMIC_RENAME_FILE_TRANSACTION_DEFAULT_TIMEOUT, description='ya library.python.windows replace_file_across_devices') as transaction: - if not ctypes.windll.kernel32.MoveFileTransactedW(unicode_path(src), unicode_path(dst), None, None, _MOVEFILE_REPLACE_EXISTING | _MOVEFILE_WRITE_THROUGH, transaction): - raise ctypes.WinError() - - @win_only - @require_ctypes - def hardlink(src, lnk): - if not ctypes.windll.kernel32.CreateHardLinkW(unicode_path(lnk), unicode_path(src), None): - raise ctypes.WinError() - - # Requires SE_CREATE_SYMBOLIC_LINK_NAME privilege - @win_only - @win_disabled - @require_ctypes - def symlink_file(src, lnk): - if not ctypes.windll.kernel32.CreateSymbolicLinkW(unicode_path(lnk), unicode_path(src), 0): - raise ctypes.WinError() - - # Requires SE_CREATE_SYMBOLIC_LINK_NAME privilege - @win_only - @win_disabled - @require_ctypes - def symlink_dir(src, lnk): - if not ctypes.windll.kernel32.CreateSymbolicLinkW(unicode_path(lnk), unicode_path(src), _SYMBOLIC_LINK_FLAG_DIRECTORY): - raise ctypes.WinError() - - @win_only - @require_ctypes - def lock_file(f, offset, length, raises=True): - locked = ctypes.windll.kernel32.LockFile(file_handle(f), _low_dword(offset), _high_dword(offset), _low_dword(length), _high_dword(length)) - if not raises: - return bool(locked) - if not locked: - raise ctypes.WinError() - - @win_only - @require_ctypes - def unlock_file(f, offset, length, raises=True): - unlocked = ctypes.windll.kernel32.UnlockFile(file_handle(f), _low_dword(offset), _high_dword(offset), _low_dword(length), _high_dword(length)) - if not raises: - return bool(unlocked) - if not unlocked: - raise ctypes.WinError() - - @win_only - @require_ctypes - def set_error_mode(mode): - return ctypes.windll.kernel32.SetErrorMode(mode) - + if not ctypes.windll.kernel32.MoveFileTransactedW(unicode_path(src), unicode_path(dst), None, None, _MOVEFILE_REPLACE_EXISTING | _MOVEFILE_WRITE_THROUGH, transaction): + raise ctypes.WinError() + + @win_only + @require_ctypes + def hardlink(src, lnk): + if not ctypes.windll.kernel32.CreateHardLinkW(unicode_path(lnk), unicode_path(src), None): + raise ctypes.WinError() + + # Requires SE_CREATE_SYMBOLIC_LINK_NAME privilege + @win_only + @win_disabled + @require_ctypes + def symlink_file(src, lnk): + if not ctypes.windll.kernel32.CreateSymbolicLinkW(unicode_path(lnk), unicode_path(src), 0): + raise ctypes.WinError() + + # Requires SE_CREATE_SYMBOLIC_LINK_NAME privilege + @win_only + @win_disabled + @require_ctypes + def symlink_dir(src, lnk): + if not ctypes.windll.kernel32.CreateSymbolicLinkW(unicode_path(lnk), unicode_path(src), _SYMBOLIC_LINK_FLAG_DIRECTORY): + raise ctypes.WinError() + + @win_only + @require_ctypes + def lock_file(f, offset, length, raises=True): + locked = ctypes.windll.kernel32.LockFile(file_handle(f), _low_dword(offset), _high_dword(offset), _low_dword(length), _high_dword(length)) + if not raises: + return bool(locked) + if not locked: + raise ctypes.WinError() + + @win_only + @require_ctypes + def unlock_file(f, offset, length, raises=True): + unlocked = ctypes.windll.kernel32.UnlockFile(file_handle(f), _low_dword(offset), _high_dword(offset), _low_dword(length), _high_dword(length)) + if not raises: + return bool(unlocked) + if not unlocked: + raise ctypes.WinError() + + @win_only + @require_ctypes + def set_error_mode(mode): + return ctypes.windll.kernel32.SetErrorMode(mode) + @win_only def rmtree(path): def error_handler(func, handling_path, execinfo): @@ -306,23 +306,23 @@ if on_win(): raise e shutil.rmtree(path, onerror=error_handler) - # Don't display the Windows GPF dialog if the invoked program dies. - # http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621.aspx - @win_only - def disable_error_dialogs(): + # Don't display the Windows GPF dialog if the invoked program dies. + # http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621.aspx + @win_only + def disable_error_dialogs(): set_error_mode(_SEM_NOGPFAULTERRORBOX | _SEM_FAILCRITICALERRORS) - - @win_only - def default_process_creation_flags(): - return 0 - - @require_ctypes - def _low_dword(x): - return ctypes.c_ulong(x & ((1 << 32) - 1)) - - @require_ctypes - def _high_dword(x): - return ctypes.c_ulong((x >> 32) & ((1 << 32) - 1)) + + @win_only + def default_process_creation_flags(): + return 0 + + @require_ctypes + def _low_dword(x): + return ctypes.c_ulong(x & ((1 << 32) - 1)) + + @require_ctypes + def _high_dword(x): + return ctypes.c_ulong((x >> 32) & ((1 << 32) - 1)) @win_only @require_ctypes @@ -351,14 +351,14 @@ if on_win(): assert isinstance(flag, bool) if not ctypes.windll.kernel32.SetHandleInformation(file_handle(file), _low_dword(value), _low_dword(int(flag))): raise ctypes.WinError() - - @win_only - @require_ctypes - def get_windows_directory(): - buf = ctypes.create_unicode_buffer(ctypes.wintypes.MAX_PATH) - size = ctypes.windll.kernel32.GetWindowsDirectoryW(buf, ctypes.wintypes.MAX_PATH) - if not size: - raise ctypes.WinError() - if size > ctypes.wintypes.MAX_PATH - 1: - raise CustomWinError(ERRORS['INSUFFICIENT_BUFFER']) - return ctypes.wstring_at(buf, size) + + @win_only + @require_ctypes + def get_windows_directory(): + buf = ctypes.create_unicode_buffer(ctypes.wintypes.MAX_PATH) + size = ctypes.windll.kernel32.GetWindowsDirectoryW(buf, ctypes.wintypes.MAX_PATH) + if not size: + raise ctypes.WinError() + if size > ctypes.wintypes.MAX_PATH - 1: + raise CustomWinError(ERRORS['INSUFFICIENT_BUFFER']) + return ctypes.wstring_at(buf, size) diff --git a/library/python/windows/ut/test_windows.py b/library/python/windows/ut/test_windows.py index 516dfa4bb4..bef3ec2dc5 100644 --- a/library/python/windows/ut/test_windows.py +++ b/library/python/windows/ut/test_windows.py @@ -1,96 +1,96 @@ -# coding=utf-8 - -import errno -import os -import pytest - +# coding=utf-8 + +import errno +import os +import pytest + import library.python.strings import library.python.windows - - -def gen_error_access_denied(): + + +def gen_error_access_denied(): if library.python.windows.on_win(): - err = WindowsError() - err.errno = errno.EACCES - err.strerror = '' + err = WindowsError() + err.errno = errno.EACCES + err.strerror = '' err.winerror = library.python.windows.ERRORS['ACCESS_DENIED'] - else: - err = OSError() - err.errno = errno.EACCES - err.strerror = os.strerror(err.errno) - err.filename = 'unknown/file' - raise err - - -def test_errorfix_buggy(): + else: + err = OSError() + err.errno = errno.EACCES + err.strerror = os.strerror(err.errno) + err.filename = 'unknown/file' + raise err + + +def test_errorfix_buggy(): @library.python.windows.errorfix - def erroneous_func(): - gen_error_access_denied() - - with pytest.raises(OSError) as errinfo: - erroneous_func() - assert errinfo.value.errno == errno.EACCES - assert errinfo.value.filename == 'unknown/file' - assert isinstance(errinfo.value.strerror, basestring) - assert errinfo.value.strerror - - -def test_errorfix_explicit(): + def erroneous_func(): + gen_error_access_denied() + + with pytest.raises(OSError) as errinfo: + erroneous_func() + assert errinfo.value.errno == errno.EACCES + assert errinfo.value.filename == 'unknown/file' + assert isinstance(errinfo.value.strerror, basestring) + assert errinfo.value.strerror + + +def test_errorfix_explicit(): @library.python.windows.errorfix - def erroneous_func(): + def erroneous_func(): if library.python.windows.on_win(): - err = WindowsError() + err = WindowsError() err.winerror = library.python.windows.ERRORS['ACCESS_DENIED'] - else: - err = OSError() - err.errno = errno.EACCES - err.strerror = 'Some error description' - err.filename = 'unknown/file' - raise err - - with pytest.raises(OSError) as errinfo: - erroneous_func() - assert errinfo.value.errno == errno.EACCES - assert errinfo.value.filename == 'unknown/file' - assert errinfo.value.strerror == 'Some error description' - - -def test_errorfix_decoding_cp1251(): + else: + err = OSError() + err.errno = errno.EACCES + err.strerror = 'Some error description' + err.filename = 'unknown/file' + raise err + + with pytest.raises(OSError) as errinfo: + erroneous_func() + assert errinfo.value.errno == errno.EACCES + assert errinfo.value.filename == 'unknown/file' + assert errinfo.value.strerror == 'Some error description' + + +def test_errorfix_decoding_cp1251(): @library.python.windows.errorfix - def erroneous_func(): - model_msg = u'Какое-то описание ошибки' + def erroneous_func(): + model_msg = u'Какое-то описание ошибки' if library.python.windows.on_win(): - err = WindowsError() + err = WindowsError() err.strerror = library.python.strings.to_str(model_msg, 'cp1251') - else: - err = OSError() + else: + err = OSError() err.strerror = library.python.strings.to_str(model_msg) - raise err - - with pytest.raises(OSError) as errinfo: - erroneous_func() - error_msg = errinfo.value.strerror - if not isinstance(errinfo.value.strerror, unicode): + raise err + + with pytest.raises(OSError) as errinfo: + erroneous_func() + error_msg = errinfo.value.strerror + if not isinstance(errinfo.value.strerror, unicode): error_msg = library.python.strings.to_unicode(error_msg) - assert error_msg == u'Какое-то описание ошибки' - - -def test_diehard(): + assert error_msg == u'Какое-то описание ошибки' + + +def test_diehard(): @library.python.windows.diehard(library.python.windows.ERRORS['ACCESS_DENIED'], tries=5) - def erroneous_func(errors): - try: - gen_error_access_denied() - except Exception as e: - errors.append(e) - raise - - raised_errors = [] - with pytest.raises(OSError) as errinfo: - erroneous_func(raised_errors) - assert errinfo.value.errno == errno.EACCES - assert any(e.errno == errno.EACCES for e in raised_errors) - assert raised_errors and errinfo.value == raised_errors[-1] + def erroneous_func(errors): + try: + gen_error_access_denied() + except Exception as e: + errors.append(e) + raise + + raised_errors = [] + with pytest.raises(OSError) as errinfo: + erroneous_func(raised_errors) + assert errinfo.value.errno == errno.EACCES + assert any(e.errno == errno.EACCES for e in raised_errors) + assert raised_errors and errinfo.value == raised_errors[-1] if library.python.windows.on_win(): - assert len(raised_errors) == 5 - else: - assert len(raised_errors) == 1 + assert len(raised_errors) == 5 + else: + assert len(raised_errors) == 1 diff --git a/library/python/windows/ut/ya.make b/library/python/windows/ut/ya.make index 992afe0259..c39f1797b8 100644 --- a/library/python/windows/ut/ya.make +++ b/library/python/windows/ut/ya.make @@ -2,7 +2,7 @@ OWNER(g:yatool) PY2TEST() -TEST_SRCS(test_windows.py) +TEST_SRCS(test_windows.py) PEERDIR( library/python/windows diff --git a/library/python/ya.make b/library/python/ya.make index 04b9e61286..2e1eb6e0e1 100644 --- a/library/python/ya.make +++ b/library/python/ya.make @@ -135,8 +135,8 @@ RECURSE( openssl par_apply par_apply/test - path - path/tests + path + path/tests protobuf pymain pyscopg2 @@ -154,8 +154,8 @@ RECURSE( reservoir_sampling refsclient resource - retry - retry/tests + retry + retry/tests runtime runtime/main runtime/test diff --git a/library/ya.make b/library/ya.make index f003ab35af..86f833bd02 100644 --- a/library/ya.make +++ b/library/ya.make @@ -15,4 +15,4 @@ IF (NOT SANITIZER_TYPE) ) ENDIF() -NEED_CHECK() +NEED_CHECK() |