0s autopkgtest [04:16:16]: starting date and time: 2025-02-19 04:16:16+0000 0s autopkgtest [04:16:16]: git checkout: 325255d2 Merge branch 'pin-any-arch' into 'ubuntu/production' 0s autopkgtest [04:16:16]: host juju-7f2275-prod-proposed-migration-environment-20; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.p_cwsf6p/out --timeout-copy=6000 --setup-commands /home/ubuntu/autopkgtest-cloud/worker-config-production/setup-canonical.sh --apt-pocket=proposed=src:python-click --apt-upgrade sqlfluff --timeout-short=300 --timeout-copy=20000 --timeout-build=20000 --env=ADT_TEST_TRIGGERS=python-click/8.2.0-1 -- ssh -s /home/ubuntu/autopkgtest/ssh-setup/nova -- --flavor autopkgtest --security-groups autopkgtest-juju-7f2275-prod-proposed-migration-environment-20@lcy02-2.secgroup --name adt-plucky-amd64-sqlfluff-20250219-041615-juju-7f2275-prod-proposed-migration-environment-20-7aca3b81-866d-4c11-827f-199c44e599a0 --image adt/ubuntu-plucky-amd64-server --keyname testbed-juju-7f2275-prod-proposed-migration-environment-20 --net-id=net_prod-proposed-migration -e TERM=linux -e ''"'"'http_proxy=http://squid.internal:3128'"'"'' -e ''"'"'https_proxy=http://squid.internal:3128'"'"'' -e ''"'"'no_proxy=127.0.0.1,127.0.1.1,login.ubuntu.com,localhost,localdomain,novalocal,internal,archive.ubuntu.com,ports.ubuntu.com,security.ubuntu.com,ddebs.ubuntu.com,changelogs.ubuntu.com,keyserver.ubuntu.com,launchpadlibrarian.net,launchpadcontent.net,launchpad.net,10.24.0.0/24,keystone.ps5.canonical.com,objectstorage.prodstack5.canonical.com,radosgw.ps5.canonical.com'"'"'' --mirror=http://ftpmaster.internal/ubuntu/ 50s autopkgtest [04:17:06]: testbed dpkg architecture: amd64 50s autopkgtest [04:17:06]: testbed apt version: 2.9.29 50s autopkgtest [04:17:06]: @@@@@@@@@@@@@@@@@@@@ test bed setup 50s autopkgtest [04:17:06]: testbed release detected to be: None 50s autopkgtest [04:17:06]: updating testbed package index (apt update) 50s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed InRelease [110 kB] 50s Hit:2 http://ftpmaster.internal/ubuntu plucky InRelease 50s Hit:3 http://ftpmaster.internal/ubuntu plucky-updates InRelease 50s Hit:4 http://ftpmaster.internal/ubuntu plucky-security InRelease 51s Get:5 http://ftpmaster.internal/ubuntu plucky-proposed/restricted Sources [3120 B] 51s Get:6 http://ftpmaster.internal/ubuntu plucky-proposed/universe Sources [788 kB] 51s Get:7 http://ftpmaster.internal/ubuntu plucky-proposed/main Sources [79.1 kB] 51s Get:8 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse Sources [14.6 kB] 51s Get:9 http://ftpmaster.internal/ubuntu plucky-proposed/main amd64 Packages [106 kB] 51s Get:10 http://ftpmaster.internal/ubuntu plucky-proposed/main i386 Packages [84.0 kB] 51s Get:11 http://ftpmaster.internal/ubuntu plucky-proposed/restricted i386 Packages [2412 B] 51s Get:12 http://ftpmaster.internal/ubuntu plucky-proposed/restricted amd64 Packages [7984 B] 51s Get:13 http://ftpmaster.internal/ubuntu plucky-proposed/universe i386 Packages [271 kB] 51s Get:14 http://ftpmaster.internal/ubuntu plucky-proposed/universe amd64 Packages [712 kB] 51s Get:15 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse amd64 Packages [12.4 kB] 51s Get:16 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse i386 Packages [3440 B] 51s Fetched 2194 kB in 0s (4867 kB/s) 52s Reading package lists... 52s Reading package lists... 52s Building dependency tree... 52s Reading state information... 53s Calculating upgrade... 53s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 53s Reading package lists... 53s Building dependency tree... 53s Reading state information... 54s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 54s autopkgtest [04:17:10]: upgrading testbed (apt dist-upgrade and autopurge) 54s Reading package lists... 54s Building dependency tree... 54s Reading state information... 55s Calculating upgrade...Starting pkgProblemResolver with broken count: 0 55s Starting 2 pkgProblemResolver with broken count: 0 55s Done 55s Entering ResolveByKeep 56s 56s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 56s Reading package lists... 56s Building dependency tree... 56s Reading state information... 56s Starting pkgProblemResolver with broken count: 0 57s Starting 2 pkgProblemResolver with broken count: 0 57s Done 57s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 59s autopkgtest [04:17:14]: testbed running kernel: Linux 6.12.0-15-generic #15-Ubuntu SMP PREEMPT_DYNAMIC Tue Feb 4 16:02:16 UTC 2025 59s autopkgtest [04:17:15]: @@@@@@@@@@@@@@@@@@@@ apt-source sqlfluff 60s Get:1 http://ftpmaster.internal/ubuntu plucky/universe sqlfluff 3.3.1-1 (dsc) [3968 B] 60s Get:2 http://ftpmaster.internal/ubuntu plucky/universe sqlfluff 3.3.1-1 (tar) [2961 kB] 60s Get:3 http://ftpmaster.internal/ubuntu plucky/universe sqlfluff 3.3.1-1 (diff) [9076 B] 60s gpgv: Signature made Sun Feb 9 16:45:26 2025 UTC 60s gpgv: using RSA key AC0A4FF12611B6FCCF01C111393587D97D86500B 60s gpgv: Can't check signature: No public key 60s dpkg-source: warning: cannot verify inline signature for ./sqlfluff_3.3.1-1.dsc: no acceptable signature found 60s autopkgtest [04:17:16]: testing package sqlfluff version 3.3.1-1 61s autopkgtest [04:17:17]: build not needed 62s autopkgtest [04:17:18]: test upstream: preparing testbed 62s Reading package lists... 63s Building dependency tree... 63s Reading state information... 63s Starting pkgProblemResolver with broken count: 0 63s Starting 2 pkgProblemResolver with broken count: 0 63s Done 63s The following NEW packages will be installed: 63s diff-cover python3-all python3-click python3-colorama python3-dateutil 63s python3-hypothesis python3-iniconfig python3-packaging python3-pathspec 63s python3-platformdirs python3-pluggy python3-pytest python3-regex 63s python3-sortedcontainers python3-tblib python3-tqdm python3.12 63s python3.12-minimal sqlfluff 63s 0 upgraded, 19 newly installed, 0 to remove and 0 not upgraded. 63s Need to get 5069 kB of archives. 63s After this operation, 20.6 MB of additional disk space will be used. 63s Get:1 http://ftpmaster.internal/ubuntu plucky/main amd64 python3.12-minimal amd64 3.12.9-1 [2348 kB] 64s Get:2 http://ftpmaster.internal/ubuntu plucky/main amd64 python3.12 amd64 3.12.9-1 [671 kB] 64s Get:3 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-pluggy all 1.5.0-1 [21.0 kB] 64s Get:4 http://ftpmaster.internal/ubuntu plucky/universe amd64 diff-cover all 9.2.2-1 [44.2 kB] 64s Get:5 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-all amd64 3.13.1-1~exp2 [894 B] 64s Get:6 http://ftpmaster.internal/ubuntu plucky-proposed/main amd64 python3-click all 8.2.0-1 [81.9 kB] 64s Get:7 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-colorama all 0.4.6-4 [32.1 kB] 64s Get:8 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-dateutil all 2.9.0-3 [80.2 kB] 64s Get:9 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-sortedcontainers all 2.4.0-2 [27.6 kB] 64s Get:10 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-hypothesis all 6.125.2-1 [333 kB] 64s Get:11 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-iniconfig all 1.1.1-2 [6024 B] 64s Get:12 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-packaging all 24.2-1 [51.5 kB] 64s Get:13 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-pathspec all 0.12.1-1 [24.5 kB] 64s Get:14 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-platformdirs all 4.3.6-1 [16.8 kB] 64s Get:15 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-pytest all 8.3.4-1 [252 kB] 64s Get:16 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-regex amd64 0.1.20241106-1 [308 kB] 64s Get:17 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-tblib all 3.0.0-6 [13.0 kB] 64s Get:18 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-tqdm all 4.67.1-2 [92.5 kB] 64s Get:19 http://ftpmaster.internal/ubuntu plucky/universe amd64 sqlfluff all 3.3.1-1 [665 kB] 64s Fetched 5069 kB in 0s (13.7 MB/s) 64s Selecting previously unselected package python3.12-minimal. 64s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 108925 files and directories currently installed.) 64s Preparing to unpack .../00-python3.12-minimal_3.12.9-1_amd64.deb ... 64s Unpacking python3.12-minimal (3.12.9-1) ... 64s Selecting previously unselected package python3.12. 64s Preparing to unpack .../01-python3.12_3.12.9-1_amd64.deb ... 64s Unpacking python3.12 (3.12.9-1) ... 64s Selecting previously unselected package python3-pluggy. 65s Preparing to unpack .../02-python3-pluggy_1.5.0-1_all.deb ... 65s Unpacking python3-pluggy (1.5.0-1) ... 65s Selecting previously unselected package diff-cover. 65s Preparing to unpack .../03-diff-cover_9.2.2-1_all.deb ... 65s Unpacking diff-cover (9.2.2-1) ... 65s Selecting previously unselected package python3-all. 65s Preparing to unpack .../04-python3-all_3.13.1-1~exp2_amd64.deb ... 65s Unpacking python3-all (3.13.1-1~exp2) ... 65s Selecting previously unselected package python3-click. 65s Preparing to unpack .../05-python3-click_8.2.0-1_all.deb ... 65s Unpacking python3-click (8.2.0-1) ... 65s Selecting previously unselected package python3-colorama. 65s Preparing to unpack .../06-python3-colorama_0.4.6-4_all.deb ... 65s Unpacking python3-colorama (0.4.6-4) ... 65s Selecting previously unselected package python3-dateutil. 65s Preparing to unpack .../07-python3-dateutil_2.9.0-3_all.deb ... 65s Unpacking python3-dateutil (2.9.0-3) ... 65s Selecting previously unselected package python3-sortedcontainers. 65s Preparing to unpack .../08-python3-sortedcontainers_2.4.0-2_all.deb ... 65s Unpacking python3-sortedcontainers (2.4.0-2) ... 65s Selecting previously unselected package python3-hypothesis. 65s Preparing to unpack .../09-python3-hypothesis_6.125.2-1_all.deb ... 65s Unpacking python3-hypothesis (6.125.2-1) ... 65s Selecting previously unselected package python3-iniconfig. 65s Preparing to unpack .../10-python3-iniconfig_1.1.1-2_all.deb ... 65s Unpacking python3-iniconfig (1.1.1-2) ... 65s Selecting previously unselected package python3-packaging. 65s Preparing to unpack .../11-python3-packaging_24.2-1_all.deb ... 65s Unpacking python3-packaging (24.2-1) ... 65s Selecting previously unselected package python3-pathspec. 65s Preparing to unpack .../12-python3-pathspec_0.12.1-1_all.deb ... 65s Unpacking python3-pathspec (0.12.1-1) ... 65s Selecting previously unselected package python3-platformdirs. 65s Preparing to unpack .../13-python3-platformdirs_4.3.6-1_all.deb ... 65s Unpacking python3-platformdirs (4.3.6-1) ... 65s Selecting previously unselected package python3-pytest. 65s Preparing to unpack .../14-python3-pytest_8.3.4-1_all.deb ... 65s Unpacking python3-pytest (8.3.4-1) ... 65s Selecting previously unselected package python3-regex. 65s Preparing to unpack .../15-python3-regex_0.1.20241106-1_amd64.deb ... 65s Unpacking python3-regex (0.1.20241106-1) ... 65s Selecting previously unselected package python3-tblib. 65s Preparing to unpack .../16-python3-tblib_3.0.0-6_all.deb ... 65s Unpacking python3-tblib (3.0.0-6) ... 65s Selecting previously unselected package python3-tqdm. 65s Preparing to unpack .../17-python3-tqdm_4.67.1-2_all.deb ... 65s Unpacking python3-tqdm (4.67.1-2) ... 65s Selecting previously unselected package sqlfluff. 65s Preparing to unpack .../18-sqlfluff_3.3.1-1_all.deb ... 65s Unpacking sqlfluff (3.3.1-1) ... 65s Setting up python3-iniconfig (1.1.1-2) ... 65s Setting up python3.12-minimal (3.12.9-1) ... 66s Setting up python3-tblib (3.0.0-6) ... 66s Setting up python3-colorama (0.4.6-4) ... 66s Setting up python3.12 (3.12.9-1) ... 68s Setting up python3-tqdm (4.67.1-2) ... 68s Setting up python3-all (3.13.1-1~exp2) ... 68s Setting up python3-sortedcontainers (2.4.0-2) ... 68s Setting up python3-click (8.2.0-1) ... 68s Setting up python3-platformdirs (4.3.6-1) ... 69s Setting up python3-packaging (24.2-1) ... 69s Setting up python3-regex (0.1.20241106-1) ... 69s Setting up python3-pluggy (1.5.0-1) ... 69s Setting up python3-dateutil (2.9.0-3) ... 69s Setting up diff-cover (9.2.2-1) ... 70s Setting up python3-pathspec (0.12.1-1) ... 70s Setting up python3-pytest (8.3.4-1) ... 70s Setting up python3-hypothesis (6.125.2-1) ... 71s Setting up sqlfluff (3.3.1-1) ... 72s Processing triggers for man-db (2.13.0-1) ... 73s Processing triggers for systemd (257.2-3ubuntu1) ... 76s autopkgtest [04:17:32]: test upstream: [----------------------- 77s + cp -a -t /tmp/autopkgtest.KLm779/autopkgtest_tmp test pyproject.toml README.md plugins 77s + cd /tmp/autopkgtest.KLm779/autopkgtest_tmp 77s + rm test/core/plugin_test.py 77s + py3versions -s 77s =-=-=-=-=-= Running tests for python3.12 =-=-=-=-=-= 77s + printf =-=-=-=-=-= Running tests for %s =-=-=-=-=-=\n python3.12 77s + python3.12 -m pytest -k not appdir test 82s ============================= test session starts ============================== 82s platform linux -- Python 3.12.9, pytest-8.3.4, pluggy-1.5.0 82s rootdir: /tmp/autopkgtest.KLm779/autopkgtest_tmp 82s configfile: pyproject.toml 82s plugins: hypothesis-6.125.2, typeguard-4.4.1 82s collected 8521 items / 1 deselected / 8520 selected 82s 82s test/api/classes_test.py .... [ 0%] 83s test/api/info_test.py .. [ 0%] 84s test/api/simple_test.py ................... [ 0%] 84s test/cli/autocomplete_test.py ..... [ 0%] 85s test/cli/commands_test.py FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF [ 0%] 87s FFFFFFFFFFFFFFFFFFFFFFFFFF.......FFFFFF.......FFFFFFFFFFFFFFFFFFFFFFFFFF [ 1%] 89s FFFFFF.FFFFFFFFFFFFFFFFF.FFFFFFFFFFFF.FFFFFFFFFFFF [ 2%] 89s test/cli/formatters_test.py ..... [ 2%] 89s test/cli/helpers_test.py ......... [ 2%] 89s test/core/config/fluffconfig_test.py ........................... [ 2%] 89s test/core/config/loader_test.py ............. [ 2%] 89s test/core/config/validate_test.py ....... [ 3%] 89s test/core/errors_test.py ...... [ 3%] 89s test/core/helpers/dict_test.py ..... [ 3%] 89s test/core/helpers/file_test.py .........s. [ 3%] 89s test/core/helpers/slice_test.py ...................... [ 3%] 89s test/core/helpers/string_test.py ....... [ 3%] 90s test/core/linter/discovery_test.py ............... [ 3%] 90s test/core/linter/fix_test.py ...... [ 3%] 90s test/core/linter/linted_file_test.py ................. [ 4%] 93s test/core/linter/linter_test.py ........................................ [ 4%] 93s ... [ 4%] 93s test/core/parser/grammar/grammar_anyof_test.py ................ [ 4%] 93s test/core/parser/grammar/grammar_other_test.py ......................... [ 5%] 93s ... [ 5%] 93s test/core/parser/grammar/grammar_ref_test.py .... [ 5%] 93s test/core/parser/grammar/grammar_sequence_test.py ...................... [ 5%] 93s ..................... [ 5%] 93s test/core/parser/helpers_test.py .... [ 5%] 94s test/core/parser/lexer_test.py .............................. [ 6%] 94s test/core/parser/markers_test.py ......... [ 6%] 94s test/core/parser/match_algorithms_test.py ...................... [ 6%] 94s test/core/parser/match_result_test.py ... [ 6%] 94s test/core/parser/parse_test.py ... [ 6%] 94s test/core/parser/parser_test.py ........... [ 6%] 94s test/core/parser/segments/segments_base_test.py ........................ [ 6%] 94s ... [ 6%] 94s test/core/parser/segments/segments_common_test.py . [ 6%] 94s test/core/parser/segments/segments_file_test.py . [ 6%] 94s test/core/parser/segments/segments_raw_test.py .. [ 6%] 94s test/core/rules/crawlers_test.py ... [ 7%] 94s test/core/rules/docstring_test.py ..... [ 7%] 94s test/core/rules/functional/raw_file_slices_test.py ...... [ 7%] 94s test/core/rules/functional/segments_test.py .................... [ 7%] 95s test/core/rules/noqa_test.py ........................................... [ 7%] 95s .... [ 7%] 95s test/core/rules/reference_test.py .............. [ 8%] 96s test/core/rules/rules_test.py ............................. [ 8%] 96s test/core/templaters/base_test.py ............................ [ 8%] 96s test/core/templaters/builtins_test.py .. [ 8%] 97s test/core/templaters/jinja_test.py ..................................... [ 9%] 100s ........................................................................ [ 10%] 100s ..... [ 10%] 101s test/core/templaters/placeholder_test.py ....................... [ 10%] 101s test/core/templaters/python_test.py .................................... [ 10%] 101s [ 10%] 101s test/dialects/ansi_test.py ............................................. [ 11%] 102s ........ [ 11%] 106s test/dialects/bigquery_test.py ...... [ 11%] 114s test/dialects/dialects_test.py ......................................... [ 11%] 128s ........................................................................ [ 12%] 133s ........................................................................ [ 13%] 139s ........................................................................ [ 14%] 148s ........................................................................ [ 15%] 157s ........................................................................ [ 16%] 171s ........................................................................ [ 17%] 178s ........................................................................ [ 17%] 183s ........................................................................ [ 18%] 186s ........................................................................ [ 19%] 191s ........................................................................ [ 20%] 199s ........................................................................ [ 21%] 208s ........................................................................ [ 22%] 220s ........................................................................ [ 22%] 228s ........................................................................ [ 23%] 234s ........................................................................ [ 24%] 237s ........................................................................ [ 25%] 243s ........................................................................ [ 26%] 256s ........................................................................ [ 27%] 264s ........................................................................ [ 28%] 270s ........................................................................ [ 28%] 273s ........................................................................ [ 29%] 279s ........................................................................ [ 30%] 287s ........................................................................ [ 31%] 296s ........................................................................ [ 32%] 328s ........................................................................ [ 33%] 376s ........................................................................ [ 33%] 387s ........................................................................ [ 34%] 407s ........................................................................ [ 35%] 428s ........................................................................ [ 36%] 455s ........................................................................ [ 37%] 508s ........................................................................ [ 38%] 531s ........................................................................ [ 39%] 545s ........................................................................ [ 39%] 552s ........................................................................ [ 40%] 573s ........................................................................ [ 41%] 593s ........................................................................ [ 42%] 619s ........................................................................ [ 43%] 650s ........................................................................ [ 44%] 686s ........................................................................ [ 44%] 703s ........................................................................ [ 45%] 710s ........................................................................ [ 46%] 722s ........................................................................ [ 47%] 750s ........................................................................ [ 48%] 770s ........................................................................ [ 49%] 781s ........................................................................ [ 50%] 788s ........................................................................ [ 50%] 800s ........................................................................ [ 51%] 829s ........................................................................ [ 52%] 871s ........................................................................ [ 53%] 883s ........................................................................ [ 54%] 893s ........................................................................ [ 55%] 898s ........................................................................ [ 55%] 903s ........................................................................ [ 56%] 908s ........................................................................ [ 57%] 917s ........................................................................ [ 58%] 928s ........................................................................ [ 59%] 935s ........................................................................ [ 60%] 939s ........................................................................ [ 61%] 941s ........................................................................ [ 61%] 946s ........................................................................ [ 62%] 952s ........................................................................ [ 63%] 960s ........................................................................ [ 64%] 967s ........................................................................ [ 65%] 976s ........................................................................ [ 66%] 981s ........................................................................ [ 66%] 984s ........................................................................ [ 67%] 988s ........................................................................ [ 68%] 997s ........................................................................ [ 69%] 1004s ........................................................................ [ 70%] 1009s ........................................................................ [ 71%] 1011s ........................................................................ [ 71%] 1016s ........................................................................ [ 72%] 1022s ........................................................................ [ 73%] 1031s ........................................................................ [ 74%] 1033s .................................................... [ 75%] 1033s test/dialects/exasol_test.py ... [ 75%] 1034s test/dialects/postgres_test.py ..................... [ 75%] 1035s test/dialects/snowflake_test.py ............... [ 75%] 1035s test/dialects/soql_test.py ...... [ 75%] 1035s test/dialects/unparsable_test.py ... [ 75%] 1037s test/diff_quality_plugin_test.py FFFF [ 75%] 1037s test/rules/std_AL04_test.py ... [ 75%] 1039s test/rules/std_AL09_CP02_RF06_combo_test.py .......... [ 75%] 1040s test/rules/std_AM06_test.py ... [ 75%] 1040s test/rules/std_CV02_test.py . [ 75%] 1040s test/rules/std_CV09_test.py . [ 75%] 1040s test/rules/std_JJ01_test.py . [ 75%] 1040s test/rules/std_LT01_LT02_LT09_combo_test.py . [ 75%] 1040s test/rules/std_LT01_LT04_test.py . [ 75%] 1040s test/rules/std_LT01_ST02_test.py . [ 76%] 1040s test/rules/std_LT02_LT04_test.py . [ 76%] 1041s test/rules/std_LT02_LT11_combo_test.py .. [ 76%] 1041s test/rules/std_LT03_test.py ... [ 76%] 1041s test/rules/std_LT04_ST06_test.py ... [ 76%] 1042s test/rules/std_LT04_test.py . [ 76%] 1042s test/rules/std_LT05_LT09_combo_test.py ... [ 76%] 1042s test/rules/std_LT12_CV06_test.py . [ 76%] 1042s test/rules/std_RF01_LT09_test.py . [ 76%] 1042s test/rules/std_RF02_test.py . [ 76%] 1042s test/rules/std_ST03_test.py . [ 76%] 1043s test/rules/std_ST05_LT08_test.py . [ 76%] 1043s test/rules/std_ST05_LT09_test.py .. [ 76%] 1052s test/rules/std_fix_auto_test.py ........................................ [ 76%] 1053s .... [ 76%] 1055s test/rules/std_roundtrip_test.py ........ [ 76%] 1056s test/rules/std_test.py ......................... [ 77%] 1064s test/rules/yaml_test_cases_test.py ..................................... [ 77%] 1074s ........................................................................ [ 78%] 1086s ........................................................................ [ 79%] 1099s ........................................................................ [ 80%] 1109s ........................................................................ [ 80%] 1120s ........................................................................ [ 81%] 1132s ........................................................................ [ 82%] 1146s ........................................................................ [ 83%] 1159s ........................................................................ [ 84%] 1173s ........................................................................ [ 85%] 1182s ........................................................................ [ 86%] 1201s ........................................................................ [ 86%] 1216s ........................................................................ [ 87%] 1235s ........................................................................ [ 88%] 1256s ........................................................................ [ 89%] 1273s ........................................................................ [ 90%] 1287s ........................................................................ [ 91%] 1302s ........................................................................ [ 91%] 1315s ........................................................................ [ 92%] 1326s ........................................................................ [ 93%] 1336s ........................................................................ [ 94%] 1344s ........................................................................ [ 95%] 1356s ........................................................................ [ 96%] 1374s ........................................................................ [ 97%] 1392s ........................................................................ [ 97%] 1398s ............................................... [ 98%] 1398s test/testing_test.py ...... [ 98%] 1400s test/utils/analysis/query_test.py ................. [ 98%] 1400s test/utils/reflow/depthmap_test.py ... [ 98%] 1401s test/utils/reflow/rebreak_test.py ................ [ 98%] 1405s test/utils/reflow/reindent_test.py ..................................... [ 99%] 1408s ....................... [ 99%] 1408s test/utils/reflow/respace_test.py .................. [ 99%] 1409s test/utils/reflow/sequence_test.py ............... [100%] 1409s 1409s =================================== FAILURES =================================== 1409s _________________________ test__cli__command_directed __________________________ 1409s 1409s def test__cli__command_directed(): 1409s """Basic checking of lint functionality.""" 1409s > result = invoke_assert_code( 1409s ret_code=1, 1409s args=[ 1409s lint, 1409s [ 1409s "--disable-progress-bar", 1409s "test/fixtures/linter/indentation_error_simple.sql", 1409s ], 1409s ], 1409s ) 1409s 1409s test/cli/commands_test.py:89: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 1 1409s args = [, ['--disable-progress-bar', 'test/fixtures/linter/indentation_error_simple.sql']] 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s __________________________ test__cli__command_dialect __________________________ 1409s 1409s def test__cli__command_dialect(): 1409s """Check the script raises the right exception on an unknown dialect.""" 1409s # The dialect is unknown should be a non-zero exit code 1409s > invoke_assert_code( 1409s ret_code=2, 1409s args=[ 1409s lint, 1409s [ 1409s "-n", 1409s "--dialect", 1409s "faslkjh", 1409s "test/fixtures/linter/indentation_error_simple.sql", 1409s ], 1409s ], 1409s ) 1409s 1409s test/cli/commands_test.py:113: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 2 1409s args = [, ['-n', '--dialect', 'faslkjh', 'test/fixtures/linter/indentation_error_simple.sql']] 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_no_dialect[command0] ____________________ 1409s 1409s command = 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s render, 1409s parse, 1409s lint, 1409s cli_format, 1409s fix, 1409s ], 1409s ) 1409s def test__cli__command_no_dialect(command): 1409s """Check the script raises the right exception no dialect.""" 1409s # The dialect is unknown should be a non-zero exit code 1409s > result = invoke_assert_code( 1409s ret_code=2, 1409s args=[ 1409s command, 1409s ["-"], 1409s ], 1409s cli_input="SELECT 1", 1409s ) 1409s 1409s test/cli/commands_test.py:140: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 2, args = [, ['-']], kwargs = {'input': 'SELECT 1'} 1409s cli_input = 'SELECT 1', mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_no_dialect[command1] ____________________ 1409s 1409s command = 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s render, 1409s parse, 1409s lint, 1409s cli_format, 1409s fix, 1409s ], 1409s ) 1409s def test__cli__command_no_dialect(command): 1409s """Check the script raises the right exception no dialect.""" 1409s # The dialect is unknown should be a non-zero exit code 1409s > result = invoke_assert_code( 1409s ret_code=2, 1409s args=[ 1409s command, 1409s ["-"], 1409s ], 1409s cli_input="SELECT 1", 1409s ) 1409s 1409s test/cli/commands_test.py:140: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 2, args = [, ['-']], kwargs = {'input': 'SELECT 1'} 1409s cli_input = 'SELECT 1', mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_no_dialect[command2] ____________________ 1409s 1409s command = 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s render, 1409s parse, 1409s lint, 1409s cli_format, 1409s fix, 1409s ], 1409s ) 1409s def test__cli__command_no_dialect(command): 1409s """Check the script raises the right exception no dialect.""" 1409s # The dialect is unknown should be a non-zero exit code 1409s > result = invoke_assert_code( 1409s ret_code=2, 1409s args=[ 1409s command, 1409s ["-"], 1409s ], 1409s cli_input="SELECT 1", 1409s ) 1409s 1409s test/cli/commands_test.py:140: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 2, args = [, ['-']], kwargs = {'input': 'SELECT 1'} 1409s cli_input = 'SELECT 1', mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_no_dialect[command3] ____________________ 1409s 1409s command = 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s render, 1409s parse, 1409s lint, 1409s cli_format, 1409s fix, 1409s ], 1409s ) 1409s def test__cli__command_no_dialect(command): 1409s """Check the script raises the right exception no dialect.""" 1409s # The dialect is unknown should be a non-zero exit code 1409s > result = invoke_assert_code( 1409s ret_code=2, 1409s args=[ 1409s command, 1409s ["-"], 1409s ], 1409s cli_input="SELECT 1", 1409s ) 1409s 1409s test/cli/commands_test.py:140: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 2, args = [, ['-']], kwargs = {'input': 'SELECT 1'} 1409s cli_input = 'SELECT 1', mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_no_dialect[command4] ____________________ 1409s 1409s command = 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s render, 1409s parse, 1409s lint, 1409s cli_format, 1409s fix, 1409s ], 1409s ) 1409s def test__cli__command_no_dialect(command): 1409s """Check the script raises the right exception no dialect.""" 1409s # The dialect is unknown should be a non-zero exit code 1409s > result = invoke_assert_code( 1409s ret_code=2, 1409s args=[ 1409s command, 1409s ["-"], 1409s ], 1409s cli_input="SELECT 1", 1409s ) 1409s 1409s test/cli/commands_test.py:140: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 2, args = [, ['-']], kwargs = {'input': 'SELECT 1'} 1409s cli_input = 'SELECT 1', mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________ test__cli__command_parse_error_dialect_explicit_warning ____________ 1409s 1409s def test__cli__command_parse_error_dialect_explicit_warning(): 1409s """Check parsing error raises the right warning.""" 1409s # For any parsing error there should be a non-zero exit code 1409s # and a human-readable warning should be displayed. 1409s # Dialect specified as commandline option. 1409s > invoke_assert_code( 1409s ret_code=1, 1409s args=[ 1409s parse, 1409s [ 1409s "-n", 1409s "--dialect", 1409s "postgres", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ], 1409s assert_output_contains=( 1409s "WARNING: Parsing errors found and dialect is set to 'postgres'. " 1409s "Have you configured your dialect correctly?" 1409s ), 1409s ) 1409s 1409s test/cli/commands_test.py:159: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 1 1409s args = [, ['-n', '--dialect', 'postgres', 'test/fixtures/cli/fail_many.sql']] 1409s kwargs = {}, cli_input = None, mix_stderr = True 1409s assert_output_contains = "WARNING: Parsing errors found and dialect is set to 'postgres'. Have you configured your dialect correctly?" 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________ test__cli__command_parse_error_dialect_implicit_warning ____________ 1409s 1409s def test__cli__command_parse_error_dialect_implicit_warning(): 1409s """Check parsing error raises the right warning.""" 1409s # For any parsing error there should be a non-zero exit code 1409s # and a human-readable warning should be displayed. 1409s # Dialect specified in .sqlfluff config. 1409s > invoke_assert_code( 1409s ret_code=1, 1409s args=[ 1409s # Config sets dialect to tsql 1409s parse, 1409s [ 1409s "-n", 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ], 1409s assert_output_contains=( 1409s "WARNING: Parsing errors found and dialect is set to 'tsql'. " 1409s "Have you configured your dialect correctly?" 1409s ), 1409s ) 1409s 1409s test/cli/commands_test.py:182: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 1 1409s args = [, ['-n', '--config', 'test/fixtures/cli/extra_configs/.sqlfluff', 'test/fixtures/cli/fail_many.sql']] 1409s kwargs = {}, cli_input = None, mix_stderr = True 1409s assert_output_contains = "WARNING: Parsing errors found and dialect is set to 'tsql'. Have you configured your dialect correctly?" 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ______________________ test__cli__command_dialect_legacy _______________________ 1409s 1409s def test__cli__command_dialect_legacy(): 1409s """Check the script raises the right exception on a legacy dialect.""" 1409s > invoke_assert_code( 1409s ret_code=2, 1409s args=[ 1409s lint, 1409s [ 1409s "-n", 1409s "--dialect", 1409s "exasol_fs", 1409s "test/fixtures/linter/indentation_error_simple.sql", 1409s ], 1409s ], 1409s assert_output_contains="Please use the 'exasol' dialect instead.", 1409s ) 1409s 1409s test/cli/commands_test.py:203: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 2 1409s args = [, ['-n', '--dialect', 'exasol_fs', 'test/fixtures/linter/indentation_error_simple.sql']] 1409s kwargs = {}, cli_input = None, mix_stderr = True 1409s assert_output_contains = "Please use the 'exasol' dialect instead." 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s _____________________ test__cli__command_extra_config_fail _____________________ 1409s 1409s def test__cli__command_extra_config_fail(): 1409s """Check the script raises the right exception non-existent extra config path.""" 1409s > invoke_assert_code( 1409s ret_code=2, 1409s args=[ 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluffsdfdfdfsfd", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ], 1409s assert_output_contains=( 1409s "Extra config path 'test/fixtures/cli/extra_configs/.sqlfluffsdfdfdfsfd' " 1409s "does not exist." 1409s ), 1409s ) 1409s 1409s test/cli/commands_test.py:220: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 2 1409s args = [, ['--config', 'test/fixtures/cli/extra_configs/.sqlfluffsdfdfdfsfd', 'test/fixtures/cli/extra_config_tsql.sql']] 1409s kwargs = {}, cli_input = None, mix_stderr = True 1409s assert_output_contains = "Extra config path 'test/fixtures/cli/extra_configs/.sqlfluffsdfdfdfsfd' does not exist." 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s _ test__cli__command_stdin_filename_config[command0-test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql-0-[L: 5, P: 1] | join_clause:\n[L: 5, P: 1] | keyword: 'POSITIONAL'] _ 1409s 1409s command = 1409s stdin_filepath = 'test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql' 1409s ret_code = 0 1409s output = "[L: 5, P: 1] | join_clause:\n[L: 5, P: 1] | keyword: 'POSITIONAL'" 1409s 1409s @pytest.mark.parametrize( 1409s ("command", "stdin_filepath", "ret_code", "output"), 1409s [ 1409s ( 1409s parse, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s ( 1409s "[L: 5, P: 1] | join_clause:\n" 1409s "[L: 5, P: 1] | keyword:" 1409s " 'POSITIONAL'" 1409s ), 1409s ), 1409s ( 1409s parse, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Parsing errors found and dialect is set to 'ansi'.", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s "All Finished!", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s "All Finished!", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Parsing errors found and dialect is set to 'ansi'.", 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "[1 templating/parsing errors found]", 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Unfixable violations detected.", 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_stdin_filename_config(command, stdin_filepath, ret_code, output): 1409s """Check the script picks up the config from the indicated path.""" 1409s > invoke_assert_code( 1409s ret_code=ret_code, 1409s args=[ 1409s command, 1409s [ 1409s "--stdin-filename", 1409s stdin_filepath, 1409s "-", 1409s ], 1409s ], 1409s cli_input=stdin_cli_input, 1409s assert_output_contains=output, 1409s ) 1409s 1409s test/cli/commands_test.py:319: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = [, ['--stdin-filename', 'test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql', '-']] 1409s kwargs = {'input': 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n'} 1409s cli_input = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1409s mix_stderr = True 1409s assert_output_contains = "[L: 5, P: 1] | join_clause:\n[L: 5, P: 1] | keyword: 'POSITIONAL'" 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s _ test__cli__command_stdin_filename_config[command1-test/fixtures/an_ansi_config_here.sql-1-Parsing errors found and dialect is set to 'ansi'.] _ 1409s 1409s command = 1409s stdin_filepath = 'test/fixtures/an_ansi_config_here.sql', ret_code = 1 1409s output = "Parsing errors found and dialect is set to 'ansi'." 1409s 1409s @pytest.mark.parametrize( 1409s ("command", "stdin_filepath", "ret_code", "output"), 1409s [ 1409s ( 1409s parse, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s ( 1409s "[L: 5, P: 1] | join_clause:\n" 1409s "[L: 5, P: 1] | keyword:" 1409s " 'POSITIONAL'" 1409s ), 1409s ), 1409s ( 1409s parse, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Parsing errors found and dialect is set to 'ansi'.", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s "All Finished!", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s "All Finished!", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Parsing errors found and dialect is set to 'ansi'.", 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "[1 templating/parsing errors found]", 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Unfixable violations detected.", 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_stdin_filename_config(command, stdin_filepath, ret_code, output): 1409s """Check the script picks up the config from the indicated path.""" 1409s > invoke_assert_code( 1409s ret_code=ret_code, 1409s args=[ 1409s command, 1409s [ 1409s "--stdin-filename", 1409s stdin_filepath, 1409s "-", 1409s ], 1409s ], 1409s cli_input=stdin_cli_input, 1409s assert_output_contains=output, 1409s ) 1409s 1409s test/cli/commands_test.py:319: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 1 1409s args = [, ['--stdin-filename', 'test/fixtures/an_ansi_config_here.sql', '-']] 1409s kwargs = {'input': 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n'} 1409s cli_input = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1409s mix_stderr = True 1409s assert_output_contains = "Parsing errors found and dialect is set to 'ansi'." 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s _ test__cli__command_stdin_filename_config[command2-test/fixtures/cli/stdin_filename/stdin_filename.sql-0-All Finished!] _ 1409s 1409s command = 1409s stdin_filepath = 'test/fixtures/cli/stdin_filename/stdin_filename.sql' 1409s ret_code = 0, output = 'All Finished!' 1409s 1409s @pytest.mark.parametrize( 1409s ("command", "stdin_filepath", "ret_code", "output"), 1409s [ 1409s ( 1409s parse, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s ( 1409s "[L: 5, P: 1] | join_clause:\n" 1409s "[L: 5, P: 1] | keyword:" 1409s " 'POSITIONAL'" 1409s ), 1409s ), 1409s ( 1409s parse, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Parsing errors found and dialect is set to 'ansi'.", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s "All Finished!", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s "All Finished!", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Parsing errors found and dialect is set to 'ansi'.", 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "[1 templating/parsing errors found]", 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Unfixable violations detected.", 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_stdin_filename_config(command, stdin_filepath, ret_code, output): 1409s """Check the script picks up the config from the indicated path.""" 1409s > invoke_assert_code( 1409s ret_code=ret_code, 1409s args=[ 1409s command, 1409s [ 1409s "--stdin-filename", 1409s stdin_filepath, 1409s "-", 1409s ], 1409s ], 1409s cli_input=stdin_cli_input, 1409s assert_output_contains=output, 1409s ) 1409s 1409s test/cli/commands_test.py:319: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = [, ['--stdin-filename', 'test/fixtures/cli/stdin_filename/stdin_filename.sql', '-']] 1409s kwargs = {'input': 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n'} 1409s cli_input = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1409s mix_stderr = True, assert_output_contains = 'All Finished!' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s _ test__cli__command_stdin_filename_config[command3-test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql-0-All Finished!] _ 1409s 1409s command = 1409s stdin_filepath = 'test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql' 1409s ret_code = 0, output = 'All Finished!' 1409s 1409s @pytest.mark.parametrize( 1409s ("command", "stdin_filepath", "ret_code", "output"), 1409s [ 1409s ( 1409s parse, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s ( 1409s "[L: 5, P: 1] | join_clause:\n" 1409s "[L: 5, P: 1] | keyword:" 1409s " 'POSITIONAL'" 1409s ), 1409s ), 1409s ( 1409s parse, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Parsing errors found and dialect is set to 'ansi'.", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s "All Finished!", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s "All Finished!", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Parsing errors found and dialect is set to 'ansi'.", 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "[1 templating/parsing errors found]", 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Unfixable violations detected.", 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_stdin_filename_config(command, stdin_filepath, ret_code, output): 1409s """Check the script picks up the config from the indicated path.""" 1409s > invoke_assert_code( 1409s ret_code=ret_code, 1409s args=[ 1409s command, 1409s [ 1409s "--stdin-filename", 1409s stdin_filepath, 1409s "-", 1409s ], 1409s ], 1409s cli_input=stdin_cli_input, 1409s assert_output_contains=output, 1409s ) 1409s 1409s test/cli/commands_test.py:319: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = [, ['--stdin-filename', 'test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql', '-']] 1409s kwargs = {'input': 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n'} 1409s cli_input = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1409s mix_stderr = True, assert_output_contains = 'All Finished!' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s _ test__cli__command_stdin_filename_config[command4-test/fixtures/an_ansi_config_here.sql-1-Parsing errors found and dialect is set to 'ansi'.] _ 1409s 1409s command = 1409s stdin_filepath = 'test/fixtures/an_ansi_config_here.sql', ret_code = 1 1409s output = "Parsing errors found and dialect is set to 'ansi'." 1409s 1409s @pytest.mark.parametrize( 1409s ("command", "stdin_filepath", "ret_code", "output"), 1409s [ 1409s ( 1409s parse, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s ( 1409s "[L: 5, P: 1] | join_clause:\n" 1409s "[L: 5, P: 1] | keyword:" 1409s " 'POSITIONAL'" 1409s ), 1409s ), 1409s ( 1409s parse, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Parsing errors found and dialect is set to 'ansi'.", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s "All Finished!", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s "All Finished!", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Parsing errors found and dialect is set to 'ansi'.", 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "[1 templating/parsing errors found]", 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Unfixable violations detected.", 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_stdin_filename_config(command, stdin_filepath, ret_code, output): 1409s """Check the script picks up the config from the indicated path.""" 1409s > invoke_assert_code( 1409s ret_code=ret_code, 1409s args=[ 1409s command, 1409s [ 1409s "--stdin-filename", 1409s stdin_filepath, 1409s "-", 1409s ], 1409s ], 1409s cli_input=stdin_cli_input, 1409s assert_output_contains=output, 1409s ) 1409s 1409s test/cli/commands_test.py:319: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 1 1409s args = [, ['--stdin-filename', 'test/fixtures/an_ansi_config_here.sql', '-']] 1409s kwargs = {'input': 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n'} 1409s cli_input = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1409s mix_stderr = True 1409s assert_output_contains = "Parsing errors found and dialect is set to 'ansi'." 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s _ test__cli__command_stdin_filename_config[command5-test/fixtures/cli/stdin_filename/stdin_filename.sql-0-SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n] _ 1409s 1409s command = 1409s stdin_filepath = 'test/fixtures/cli/stdin_filename/stdin_filename.sql' 1409s ret_code = 0 1409s output = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1409s 1409s @pytest.mark.parametrize( 1409s ("command", "stdin_filepath", "ret_code", "output"), 1409s [ 1409s ( 1409s parse, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s ( 1409s "[L: 5, P: 1] | join_clause:\n" 1409s "[L: 5, P: 1] | keyword:" 1409s " 'POSITIONAL'" 1409s ), 1409s ), 1409s ( 1409s parse, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Parsing errors found and dialect is set to 'ansi'.", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s "All Finished!", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s "All Finished!", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Parsing errors found and dialect is set to 'ansi'.", 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "[1 templating/parsing errors found]", 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Unfixable violations detected.", 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_stdin_filename_config(command, stdin_filepath, ret_code, output): 1409s """Check the script picks up the config from the indicated path.""" 1409s > invoke_assert_code( 1409s ret_code=ret_code, 1409s args=[ 1409s command, 1409s [ 1409s "--stdin-filename", 1409s stdin_filepath, 1409s "-", 1409s ], 1409s ], 1409s cli_input=stdin_cli_input, 1409s assert_output_contains=output, 1409s ) 1409s 1409s test/cli/commands_test.py:319: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = [, ['--stdin-filename', 'test/fixtures/cli/stdin_filename/stdin_filename.sql', '-']] 1409s kwargs = {'input': 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n'} 1409s cli_input = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1409s mix_stderr = True 1409s assert_output_contains = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s _ test__cli__command_stdin_filename_config[command6-test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql-0-SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n] _ 1409s 1409s command = 1409s stdin_filepath = 'test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql' 1409s ret_code = 0 1409s output = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1409s 1409s @pytest.mark.parametrize( 1409s ("command", "stdin_filepath", "ret_code", "output"), 1409s [ 1409s ( 1409s parse, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s ( 1409s "[L: 5, P: 1] | join_clause:\n" 1409s "[L: 5, P: 1] | keyword:" 1409s " 'POSITIONAL'" 1409s ), 1409s ), 1409s ( 1409s parse, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Parsing errors found and dialect is set to 'ansi'.", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s "All Finished!", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s "All Finished!", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Parsing errors found and dialect is set to 'ansi'.", 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "[1 templating/parsing errors found]", 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Unfixable violations detected.", 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_stdin_filename_config(command, stdin_filepath, ret_code, output): 1409s """Check the script picks up the config from the indicated path.""" 1409s > invoke_assert_code( 1409s ret_code=ret_code, 1409s args=[ 1409s command, 1409s [ 1409s "--stdin-filename", 1409s stdin_filepath, 1409s "-", 1409s ], 1409s ], 1409s cli_input=stdin_cli_input, 1409s assert_output_contains=output, 1409s ) 1409s 1409s test/cli/commands_test.py:319: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = [, ['--stdin-filename', 'test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql', '-']] 1409s kwargs = {'input': 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n'} 1409s cli_input = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1409s mix_stderr = True 1409s assert_output_contains = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s _ test__cli__command_stdin_filename_config[command7-test/fixtures/an_ansi_config_here.sql-1-[1 templating/parsing errors found]] _ 1409s 1409s command = 1409s stdin_filepath = 'test/fixtures/an_ansi_config_here.sql', ret_code = 1 1409s output = '[1 templating/parsing errors found]' 1409s 1409s @pytest.mark.parametrize( 1409s ("command", "stdin_filepath", "ret_code", "output"), 1409s [ 1409s ( 1409s parse, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s ( 1409s "[L: 5, P: 1] | join_clause:\n" 1409s "[L: 5, P: 1] | keyword:" 1409s " 'POSITIONAL'" 1409s ), 1409s ), 1409s ( 1409s parse, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Parsing errors found and dialect is set to 'ansi'.", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s "All Finished!", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s "All Finished!", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Parsing errors found and dialect is set to 'ansi'.", 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "[1 templating/parsing errors found]", 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Unfixable violations detected.", 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_stdin_filename_config(command, stdin_filepath, ret_code, output): 1409s """Check the script picks up the config from the indicated path.""" 1409s > invoke_assert_code( 1409s ret_code=ret_code, 1409s args=[ 1409s command, 1409s [ 1409s "--stdin-filename", 1409s stdin_filepath, 1409s "-", 1409s ], 1409s ], 1409s cli_input=stdin_cli_input, 1409s assert_output_contains=output, 1409s ) 1409s 1409s test/cli/commands_test.py:319: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 1 1409s args = [, ['--stdin-filename', 'test/fixtures/an_ansi_config_here.sql', '-']] 1409s kwargs = {'input': 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n'} 1409s cli_input = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1409s mix_stderr = True 1409s assert_output_contains = '[1 templating/parsing errors found]' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s _ test__cli__command_stdin_filename_config[command8-test/fixtures/cli/stdin_filename/stdin_filename.sql-0-SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n] _ 1409s 1409s command = 1409s stdin_filepath = 'test/fixtures/cli/stdin_filename/stdin_filename.sql' 1409s ret_code = 0 1409s output = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1409s 1409s @pytest.mark.parametrize( 1409s ("command", "stdin_filepath", "ret_code", "output"), 1409s [ 1409s ( 1409s parse, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s ( 1409s "[L: 5, P: 1] | join_clause:\n" 1409s "[L: 5, P: 1] | keyword:" 1409s " 'POSITIONAL'" 1409s ), 1409s ), 1409s ( 1409s parse, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Parsing errors found and dialect is set to 'ansi'.", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s "All Finished!", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s "All Finished!", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Parsing errors found and dialect is set to 'ansi'.", 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "[1 templating/parsing errors found]", 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Unfixable violations detected.", 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_stdin_filename_config(command, stdin_filepath, ret_code, output): 1409s """Check the script picks up the config from the indicated path.""" 1409s > invoke_assert_code( 1409s ret_code=ret_code, 1409s args=[ 1409s command, 1409s [ 1409s "--stdin-filename", 1409s stdin_filepath, 1409s "-", 1409s ], 1409s ], 1409s cli_input=stdin_cli_input, 1409s assert_output_contains=output, 1409s ) 1409s 1409s test/cli/commands_test.py:319: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = [, ['--stdin-filename', 'test/fixtures/cli/stdin_filename/stdin_filename.sql', '-']] 1409s kwargs = {'input': 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n'} 1409s cli_input = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1409s mix_stderr = True 1409s assert_output_contains = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s _ test__cli__command_stdin_filename_config[command9-test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql-0-SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n] _ 1409s 1409s command = 1409s stdin_filepath = 'test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql' 1409s ret_code = 0 1409s output = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1409s 1409s @pytest.mark.parametrize( 1409s ("command", "stdin_filepath", "ret_code", "output"), 1409s [ 1409s ( 1409s parse, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s ( 1409s "[L: 5, P: 1] | join_clause:\n" 1409s "[L: 5, P: 1] | keyword:" 1409s " 'POSITIONAL'" 1409s ), 1409s ), 1409s ( 1409s parse, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Parsing errors found and dialect is set to 'ansi'.", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s "All Finished!", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s "All Finished!", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Parsing errors found and dialect is set to 'ansi'.", 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "[1 templating/parsing errors found]", 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Unfixable violations detected.", 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_stdin_filename_config(command, stdin_filepath, ret_code, output): 1409s """Check the script picks up the config from the indicated path.""" 1409s > invoke_assert_code( 1409s ret_code=ret_code, 1409s args=[ 1409s command, 1409s [ 1409s "--stdin-filename", 1409s stdin_filepath, 1409s "-", 1409s ], 1409s ], 1409s cli_input=stdin_cli_input, 1409s assert_output_contains=output, 1409s ) 1409s 1409s test/cli/commands_test.py:319: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = [, ['--stdin-filename', 'test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql', '-']] 1409s kwargs = {'input': 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n'} 1409s cli_input = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1409s mix_stderr = True 1409s assert_output_contains = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s _ test__cli__command_stdin_filename_config[command10-test/fixtures/an_ansi_config_here.sql-1-Unfixable violations detected.] _ 1409s 1409s command = 1409s stdin_filepath = 'test/fixtures/an_ansi_config_here.sql', ret_code = 1 1409s output = 'Unfixable violations detected.' 1409s 1409s @pytest.mark.parametrize( 1409s ("command", "stdin_filepath", "ret_code", "output"), 1409s [ 1409s ( 1409s parse, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s ( 1409s "[L: 5, P: 1] | join_clause:\n" 1409s "[L: 5, P: 1] | keyword:" 1409s " 'POSITIONAL'" 1409s ), 1409s ), 1409s ( 1409s parse, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Parsing errors found and dialect is set to 'ansi'.", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s "All Finished!", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s "All Finished!", 1409s ), 1409s ( 1409s lint, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Parsing errors found and dialect is set to 'ansi'.", 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s cli_format, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "[1 templating/parsing errors found]", 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1409s 0, 1409s stdin_cli_input, 1409s ), 1409s ( 1409s fix, 1409s "test/fixtures/an_ansi_config_here.sql", 1409s 1, 1409s "Unfixable violations detected.", 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_stdin_filename_config(command, stdin_filepath, ret_code, output): 1409s """Check the script picks up the config from the indicated path.""" 1409s > invoke_assert_code( 1409s ret_code=ret_code, 1409s args=[ 1409s command, 1409s [ 1409s "--stdin-filename", 1409s stdin_filepath, 1409s "-", 1409s ], 1409s ], 1409s cli_input=stdin_cli_input, 1409s assert_output_contains=output, 1409s ) 1409s 1409s test/cli/commands_test.py:319: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 1 1409s args = [, ['--stdin-filename', 'test/fixtures/an_ansi_config_here.sql', '-']] 1409s kwargs = {'input': 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n'} 1409s cli_input = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1409s mix_stderr = True, assert_output_contains = 'Unfixable violations detected.' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_stdin[command0] ____________________ 1409s 1409s command = ('-', '-n') 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s ( 1409s "-", 1409s "-n", 1409s ), 1409s ( 1409s "-", 1409s "-n", 1409s "-v", 1409s ), 1409s ( 1409s "-", 1409s "-n", 1409s "-vv", 1409s ), 1409s ( 1409s "-", 1409s "-vv", 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_lint_stdin(command): 1409s """Check basic commands on a simple script using stdin. 1409s 1409s The subprocess command should exit without errors, as no issues should be found. 1409s """ 1409s with open("test/fixtures/cli/passing_a.sql") as test_file: 1409s sql = test_file.read() 1409s > invoke_assert_code(args=[lint, ("--dialect=ansi",) + command], cli_input=sql) 1409s 1409s test/cli/commands_test.py:364: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0, args = [, ('--dialect=ansi', '-', '-n')] 1409s kwargs = {'input': 'SELECT\n tbl.name,\n tbl.value\nFROM tbl\n'} 1409s cli_input = 'SELECT\n tbl.name,\n tbl.value\nFROM tbl\n' 1409s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_stdin[command1] ____________________ 1409s 1409s command = ('-', '-n', '-v') 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s ( 1409s "-", 1409s "-n", 1409s ), 1409s ( 1409s "-", 1409s "-n", 1409s "-v", 1409s ), 1409s ( 1409s "-", 1409s "-n", 1409s "-vv", 1409s ), 1409s ( 1409s "-", 1409s "-vv", 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_lint_stdin(command): 1409s """Check basic commands on a simple script using stdin. 1409s 1409s The subprocess command should exit without errors, as no issues should be found. 1409s """ 1409s with open("test/fixtures/cli/passing_a.sql") as test_file: 1409s sql = test_file.read() 1409s > invoke_assert_code(args=[lint, ("--dialect=ansi",) + command], cli_input=sql) 1409s 1409s test/cli/commands_test.py:364: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0, args = [, ('--dialect=ansi', '-', '-n', '-v')] 1409s kwargs = {'input': 'SELECT\n tbl.name,\n tbl.value\nFROM tbl\n'} 1409s cli_input = 'SELECT\n tbl.name,\n tbl.value\nFROM tbl\n' 1409s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_stdin[command2] ____________________ 1409s 1409s command = ('-', '-n', '-vv') 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s ( 1409s "-", 1409s "-n", 1409s ), 1409s ( 1409s "-", 1409s "-n", 1409s "-v", 1409s ), 1409s ( 1409s "-", 1409s "-n", 1409s "-vv", 1409s ), 1409s ( 1409s "-", 1409s "-vv", 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_lint_stdin(command): 1409s """Check basic commands on a simple script using stdin. 1409s 1409s The subprocess command should exit without errors, as no issues should be found. 1409s """ 1409s with open("test/fixtures/cli/passing_a.sql") as test_file: 1409s sql = test_file.read() 1409s > invoke_assert_code(args=[lint, ("--dialect=ansi",) + command], cli_input=sql) 1409s 1409s test/cli/commands_test.py:364: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0, args = [, ('--dialect=ansi', '-', '-n', '-vv')] 1409s kwargs = {'input': 'SELECT\n tbl.name,\n tbl.value\nFROM tbl\n'} 1409s cli_input = 'SELECT\n tbl.name,\n tbl.value\nFROM tbl\n' 1409s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_stdin[command3] ____________________ 1409s 1409s command = ('-', '-vv') 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s ( 1409s "-", 1409s "-n", 1409s ), 1409s ( 1409s "-", 1409s "-n", 1409s "-v", 1409s ), 1409s ( 1409s "-", 1409s "-n", 1409s "-vv", 1409s ), 1409s ( 1409s "-", 1409s "-vv", 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_lint_stdin(command): 1409s """Check basic commands on a simple script using stdin. 1409s 1409s The subprocess command should exit without errors, as no issues should be found. 1409s """ 1409s with open("test/fixtures/cli/passing_a.sql") as test_file: 1409s sql = test_file.read() 1409s > invoke_assert_code(args=[lint, ("--dialect=ansi",) + command], cli_input=sql) 1409s 1409s test/cli/commands_test.py:364: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0, args = [, ('--dialect=ansi', '-', '-vv')] 1409s kwargs = {'input': 'SELECT\n tbl.name,\n tbl.value\nFROM tbl\n'} 1409s cli_input = 'SELECT\n tbl.name,\n tbl.value\nFROM tbl\n' 1409s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s _____________________ test__cli__command_lint_empty_stdin ______________________ 1409s 1409s def test__cli__command_lint_empty_stdin(): 1409s """Check linting an empty file raises no exceptions. 1409s 1409s https://github.com/sqlfluff/sqlfluff/issues/4807 1409s """ 1409s > invoke_assert_code(args=[lint, ("-d", "ansi", "-")], cli_input="") 1409s 1409s test/cli/commands_test.py:372: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0, args = [, ('-d', 'ansi', '-')], kwargs = {} 1409s cli_input = '', mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s _______________________ test__cli__command_render_stdin ________________________ 1409s 1409s def test__cli__command_render_stdin(): 1409s """Check render on a simple script using stdin.""" 1409s with open("test/fixtures/cli/passing_a.sql") as test_file: 1409s sql = test_file.read() 1409s 1409s > invoke_assert_code( 1409s args=[render, ("--dialect=ansi", "-")], 1409s cli_input=sql, 1409s # Check we get back out the same file we input. 1409s assert_output_contains=sql, 1409s ) 1409s 1409s test/cli/commands_test.py:380: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0, args = [, ('--dialect=ansi', '-')] 1409s kwargs = {'input': 'SELECT\n tbl.name,\n tbl.value\nFROM tbl\n'} 1409s cli_input = 'SELECT\n tbl.name,\n tbl.value\nFROM tbl\n' 1409s mix_stderr = True 1409s assert_output_contains = 'SELECT\n tbl.name,\n tbl.value\nFROM tbl\n' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command0] ____________________ 1409s 1409s command = (, ['-n', 'test/fixtures/cli/passing_b.sql', '--exclude-rules', 'AM05']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['-n', 'test/fixtures/cli/passing_b.sql', '--exclude-rules', 'AM05']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command1] ____________________ 1409s 1409s command = (, ['test/fixtures/cli/passing_b.sql']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0, args = (, ['test/fixtures/cli/passing_b.sql']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command2] ____________________ 1409s 1409s command = (, ['test/fixtures/cli/jinja_variants.sql']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['test/fixtures/cli/jinja_variants.sql']), kwargs = {} 1409s cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command3] ____________________ 1409s 1409s command = (, ['-n', 'test/fixtures/cli/passing_a.sql']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0, args = (, ['-n', 'test/fixtures/cli/passing_a.sql']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command4] ____________________ 1409s 1409s command = (, ['-n', '-v', 'test/fixtures/cli/passing_a.sql']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['-n', '-v', 'test/fixtures/cli/passing_a.sql']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command5] ____________________ 1409s 1409s command = (, ['-n', '-vvvv', 'test/fixtures/cli/passing_a.sql']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['-n', '-vvvv', 'test/fixtures/cli/passing_a.sql']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command6] ____________________ 1409s 1409s command = (, ['-vvvv', 'test/fixtures/cli/passing_a.sql']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['-vvvv', 'test/fixtures/cli/passing_a.sql']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command7] ____________________ 1409s 1409s command = (, ['-n', 'test/fixtures/cli/passing_b.sql', '-vvvvvvvvvvv', '--exclude-rules', 'AM05']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['-n', 'test/fixtures/cli/passing_b.sql', '-vvvvvvvvvvv', '--exclude-rules', 'AM05']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command8] ____________________ 1409s 1409s command = (, ['-n', 'test/fixtures/cli/passing_b.sql', '-vvv', '--logger', 'parser', '-e', ...]) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['-n', 'test/fixtures/cli/passing_b.sql', '-vvv', '--logger', 'parser', '-e', ...]) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command9] ____________________ 1409s 1409s command = (, ['-n', 'test/fixtures/cli/passing_b.sql', '--exclude-rules', 'AM05']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['-n', 'test/fixtures/cli/passing_b.sql', '--exclude-rules', 'AM05']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command10] ___________________ 1409s 1409s command = (, ['-n', 'test/fixtures/cli/passing_b.sql', '-vvvvvvvvvvv', '-e', 'AM05']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['-n', 'test/fixtures/cli/passing_b.sql', '-vvvvvvvvvvv', '-e', 'AM05']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command11] ___________________ 1409s 1409s command = (, ['-n', 'test/fixtures/cli/passing_b.sql', '-c']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['-n', 'test/fixtures/cli/passing_b.sql', '-c']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command12] ___________________ 1409s 1409s command = (, ['-n', 'test/fixtures/cli/passing_b.sql', '-c', '--format', 'yaml']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['-n', 'test/fixtures/cli/passing_b.sql', '-c', '--format', 'yaml']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command13] ___________________ 1409s 1409s command = (, ['-n', 'test/fixtures/cli/passing_b.sql', '--format', 'yaml']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['-n', 'test/fixtures/cli/passing_b.sql', '--format', 'yaml']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command14] ___________________ 1409s 1409s command = (, ['-n', 'test/fixtures/cli/passing_b.sql', '--format', 'none']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['-n', 'test/fixtures/cli/passing_b.sql', '--format', 'none']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command15] ___________________ 1409s 1409s command = (, ['test/fixtures/cli/jinja_variants.sql']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0, args = (, ['test/fixtures/cli/jinja_variants.sql']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command16] ___________________ 1409s 1409s command = (, ['-n', 'test/fixtures/cli/passing_timing.sql', '--bench']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['-n', 'test/fixtures/cli/passing_timing.sql', '--bench']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command17] ___________________ 1409s 1409s command = (, ['-n', 'test/fixtures/cli/passing_timing.sql', '--bench']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['-n', 'test/fixtures/cli/passing_timing.sql', '--bench']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command18] ___________________ 1409s 1409s command = (, ['-n', 'test/fixtures/cli/passing_timing.sql', '--bench']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['-n', 'test/fixtures/cli/passing_timing.sql', '--bench']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command19] ___________________ 1409s 1409s command = (, ['-n', '--rules', 'CP01', 'test/fixtures/linter/operator_errors.sql']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['-n', '--rules', 'CP01', 'test/fixtures/linter/operator_errors.sql']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command20] ___________________ 1409s 1409s command = (, ['-n', '--ignore', 'linting', '-p', '2', 'test/fixtures/linter/operator_errors.sql', ...]) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['-n', '--ignore', 'linting', '-p', '2', 'test/fixtures/linter/operator_errors.sql', ...]) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command21] ___________________ 1409s 1409s command = (, ['-n', '--rules', 'CP01,LT02', 'test/fixtures/linter/operator_errors.sql']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['-n', '--rules', 'CP01,LT02', 'test/fixtures/linter/operator_errors.sql']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command22] ___________________ 1409s 1409s command = (, ['-n', '--rules', 'CP01,LT01', '--exclude-rules', 'LT01,AL07', 'test/fixtures/linter/operator_errors.sql']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['-n', '--rules', 'CP01,LT01', '--exclude-rules', 'LT01,AL07', 'test/fixtures/linter/operator_errors.sql']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command23] ___________________ 1409s 1409s command = (, ['-n', '--exclude-rules', 'LT01,LT03,AL07', 'test/fixtures/linter/operator_errors.sql']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['-n', '--exclude-rules', 'LT01,LT03,AL07', 'test/fixtures/linter/operator_errors.sql']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command24] ___________________ 1409s 1409s command = (, ['-n', '--exclude-rules', 'LT02,LT12,AL07', '--ignore', 'parsing,lexing', 'test/fixtures/linter/parse_lex_error.sql']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['-n', '--exclude-rules', 'LT02,LT12,AL07', '--ignore', 'parsing,lexing', 'test/fixtures/linter/parse_lex_error.sql']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command25] ___________________ 1409s 1409s command = (, ['--nofail', 'test/fixtures/linter/parse_lex_error.sql']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['--nofail', 'test/fixtures/linter/parse_lex_error.sql']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command26] ___________________ 1409s 1409s command = (, ['--config', 'test/fixtures/cli/extra_configs/.sqlfluff', 'test/fixtures/cli/extra_config_tsql.sql']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['--config', 'test/fixtures/cli/extra_configs/.sqlfluff', 'test/fixtures/cli/extra_config_tsql.sql']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command27] ___________________ 1409s 1409s command = (, ['--config', 'test/fixtures/cli/extra_configs/pyproject.toml', 'test/fixtures/cli/extra_config_tsql.sql']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['--config', 'test/fixtures/cli/extra_configs/pyproject.toml', 'test/fixtures/cli/extra_config_tsql.sql']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command28] ___________________ 1409s 1409s command = (, ['test/fixtures/cli/passing_a.sql', '--persist-timing', 'test.csv']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['test/fixtures/cli/passing_a.sql', '--persist-timing', 'test.csv']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________ test__cli__command_lint_parse[command29] ___________________ 1409s 1409s command = (, ['--help']) 1409s 1409s @pytest.mark.parametrize( 1409s "command", 1409s [ 1409s # Test basic linting 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Basic render 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/passing_b.sql", 1409s ], 1409s ), 1409s # Render with variants 1409s ( 1409s render, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Original tests from test__cli__command_lint 1409s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1409s # Test basic linting with very high verbosity 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic linting with specific logger. 1409s # Also test short rule exclusion. 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvv", 1409s "--logger", 1409s "parser", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "--exclude-rules", 1409s "AM05", 1409s ], 1409s ), 1409s # Test basic parsing with very high verbosity 1409s ( 1409s parse, 1409s [ 1409s "-n", 1409s "test/fixtures/cli/passing_b.sql", 1409s "-vvvvvvvvvvv", 1409s "-e", 1409s "AM05", 1409s ], 1409s ), 1409s # Check basic parsing, with the code only option 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1409s # Check basic parsing, with the yaml output 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1409s # Check parsing with no output (used mostly for testing) 1409s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1409s # Parsing with variants 1409s ( 1409s parse, 1409s [ 1409s "test/fixtures/cli/jinja_variants.sql", 1409s ], 1409s ), 1409s # Check the benching commands 1409s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1409s # Check linting works in specifying rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check ignoring linting (multiprocess) 1409s # https://github.com/sqlfluff/sqlfluff/issues/5066 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--ignore", 1409s "linting", 1409s "-p", 1409s "2", 1409s "test/fixtures/linter/operator_errors.sql", 1409s "test/fixtures/linter/comma_errors.sql", 1409s ], 1409s ), 1409s # Check linting works in specifying multiple rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT02", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with both included and excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--rules", 1409s "CP01,LT01", 1409s "--exclude-rules", 1409s "LT01,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check linting works with just excluded rules 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT01,LT03,AL07", 1409s "test/fixtures/linter/operator_errors.sql", 1409s ], 1409s ), 1409s # Check that ignoring works (also checks that unicode files parse). 1409s ( 1409s lint, 1409s [ 1409s "-n", 1409s "--exclude-rules", 1409s "LT02,LT12,AL07", 1409s "--ignore", 1409s "parsing,lexing", 1409s "test/fixtures/linter/parse_lex_error.sql", 1409s ], 1409s ), 1409s # Check nofail works 1409s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1409s # Check config works (sets dialect to tsql) 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/.sqlfluff", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s ( 1409s lint, 1409s [ 1409s "--config", 1409s "test/fixtures/cli/extra_configs/pyproject.toml", 1409s "test/fixtures/cli/extra_config_tsql.sql", 1409s ], 1409s ), 1409s # Check timing outputs doesn't raise exceptions 1409s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1409s # Check lint --help command doesn't raise exception. 1409s # NOTE: This tests the LazySequence in action. 1409s (lint, ["--help"]), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse(command): 1409s """Check basic commands on a more complicated script.""" 1409s > invoke_assert_code(args=command) 1409s 1409s test/cli/commands_test.py:580: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0, args = (, ['--help']), kwargs = {}, cli_input = None 1409s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ____________ test__cli__command_lint_parse_with_retcode[command0-1] ____________ 1409s 1409s command = (, ['--rules', 'LT01', 'test/fixtures/cli/fail_many.sql', '-vvvvvvv']) 1409s ret_code = 1 1409s 1409s @pytest.mark.parametrize( 1409s "command, ret_code", 1409s [ 1409s # Check the script doesn't raise an unexpected exception with badly formed 1409s # files. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "test/fixtures/cli/fail_many.sql", 1409s "-vvvvvvv", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix with a suffixs 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix without specifying rules 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Format 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format with --persist-timing 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s "--persist-timing", 1409s "test.csv", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format (specifying rules) 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Template syntax error in macro file 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test overriding library path when it doesn't cause an issue 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1409s ), 1409s 0, 1409s ), 1409s # Test overriding library path when it DOES cause an issue 1409s # (because macros won't be found). 1409s ( 1409s ( 1409s # Render because that's the step where the issue will 1409s # occur. 1409s render, 1409s [ 1409s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1409s "--library-path", 1409s "none", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test render fail 1409s ( 1409s ( 1409s render, 1409s ["test/fixtures/cli/fail_many.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test a longer lint fail with --bench 1409s # This tests the threshold rules clause 1409s ( 1409s ( 1409s lint, 1409s [ 1409s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1409s "--bench", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test that setting --quiet with --verbose raises an error. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--quiet", 1409s "--verbose", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Test machine format parse command with an unparsable file. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s # Test machine format parse command with a fatal templating error. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1409s """Check commands expecting a non-zero ret code.""" 1409s > invoke_assert_code(ret_code=ret_code, args=command) 1409s 1409s test/cli/commands_test.py:749: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 1 1409s args = (, ['--rules', 'LT01', 'test/fixtures/cli/fail_many.sql', '-vvvvvvv']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ____________ test__cli__command_lint_parse_with_retcode[command1-1] ____________ 1409s 1409s command = (, ['--rules', 'LT01', '--fixed-suffix', '_fix', 'test/fixtures/cli/fail_many.sql']) 1409s ret_code = 1 1409s 1409s @pytest.mark.parametrize( 1409s "command, ret_code", 1409s [ 1409s # Check the script doesn't raise an unexpected exception with badly formed 1409s # files. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "test/fixtures/cli/fail_many.sql", 1409s "-vvvvvvv", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix with a suffixs 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix without specifying rules 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Format 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format with --persist-timing 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s "--persist-timing", 1409s "test.csv", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format (specifying rules) 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Template syntax error in macro file 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test overriding library path when it doesn't cause an issue 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1409s ), 1409s 0, 1409s ), 1409s # Test overriding library path when it DOES cause an issue 1409s # (because macros won't be found). 1409s ( 1409s ( 1409s # Render because that's the step where the issue will 1409s # occur. 1409s render, 1409s [ 1409s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1409s "--library-path", 1409s "none", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test render fail 1409s ( 1409s ( 1409s render, 1409s ["test/fixtures/cli/fail_many.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test a longer lint fail with --bench 1409s # This tests the threshold rules clause 1409s ( 1409s ( 1409s lint, 1409s [ 1409s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1409s "--bench", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test that setting --quiet with --verbose raises an error. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--quiet", 1409s "--verbose", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Test machine format parse command with an unparsable file. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s # Test machine format parse command with a fatal templating error. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1409s """Check commands expecting a non-zero ret code.""" 1409s > invoke_assert_code(ret_code=ret_code, args=command) 1409s 1409s test/cli/commands_test.py:749: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 1 1409s args = (, ['--rules', 'LT01', '--fixed-suffix', '_fix', 'test/fixtures/cli/fail_many.sql']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ____________ test__cli__command_lint_parse_with_retcode[command2-1] ____________ 1409s 1409s command = (, ['--fixed-suffix', '_fix', 'test/fixtures/cli/fail_many.sql']) 1409s ret_code = 1 1409s 1409s @pytest.mark.parametrize( 1409s "command, ret_code", 1409s [ 1409s # Check the script doesn't raise an unexpected exception with badly formed 1409s # files. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "test/fixtures/cli/fail_many.sql", 1409s "-vvvvvvv", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix with a suffixs 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix without specifying rules 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Format 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format with --persist-timing 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s "--persist-timing", 1409s "test.csv", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format (specifying rules) 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Template syntax error in macro file 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test overriding library path when it doesn't cause an issue 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1409s ), 1409s 0, 1409s ), 1409s # Test overriding library path when it DOES cause an issue 1409s # (because macros won't be found). 1409s ( 1409s ( 1409s # Render because that's the step where the issue will 1409s # occur. 1409s render, 1409s [ 1409s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1409s "--library-path", 1409s "none", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test render fail 1409s ( 1409s ( 1409s render, 1409s ["test/fixtures/cli/fail_many.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test a longer lint fail with --bench 1409s # This tests the threshold rules clause 1409s ( 1409s ( 1409s lint, 1409s [ 1409s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1409s "--bench", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test that setting --quiet with --verbose raises an error. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--quiet", 1409s "--verbose", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Test machine format parse command with an unparsable file. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s # Test machine format parse command with a fatal templating error. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1409s """Check commands expecting a non-zero ret code.""" 1409s > invoke_assert_code(ret_code=ret_code, args=command) 1409s 1409s test/cli/commands_test.py:749: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 1 1409s args = (, ['--fixed-suffix', '_fix', 'test/fixtures/cli/fail_many.sql']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ____________ test__cli__command_lint_parse_with_retcode[command3-0] ____________ 1409s 1409s command = (, ['--fixed-suffix', '_fix', 'test/fixtures/linter/whitespace_errors.sql']) 1409s ret_code = 0 1409s 1409s @pytest.mark.parametrize( 1409s "command, ret_code", 1409s [ 1409s # Check the script doesn't raise an unexpected exception with badly formed 1409s # files. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "test/fixtures/cli/fail_many.sql", 1409s "-vvvvvvv", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix with a suffixs 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix without specifying rules 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Format 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format with --persist-timing 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s "--persist-timing", 1409s "test.csv", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format (specifying rules) 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Template syntax error in macro file 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test overriding library path when it doesn't cause an issue 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1409s ), 1409s 0, 1409s ), 1409s # Test overriding library path when it DOES cause an issue 1409s # (because macros won't be found). 1409s ( 1409s ( 1409s # Render because that's the step where the issue will 1409s # occur. 1409s render, 1409s [ 1409s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1409s "--library-path", 1409s "none", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test render fail 1409s ( 1409s ( 1409s render, 1409s ["test/fixtures/cli/fail_many.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test a longer lint fail with --bench 1409s # This tests the threshold rules clause 1409s ( 1409s ( 1409s lint, 1409s [ 1409s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1409s "--bench", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test that setting --quiet with --verbose raises an error. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--quiet", 1409s "--verbose", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Test machine format parse command with an unparsable file. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s # Test machine format parse command with a fatal templating error. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1409s """Check commands expecting a non-zero ret code.""" 1409s > invoke_assert_code(ret_code=ret_code, args=command) 1409s 1409s test/cli/commands_test.py:749: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['--fixed-suffix', '_fix', 'test/fixtures/linter/whitespace_errors.sql']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ____________ test__cli__command_lint_parse_with_retcode[command4-0] ____________ 1409s 1409s command = (, ['--fixed-suffix', '_fix', 'test/fixtures/linter/whitespace_errors.sql', '--persist-timing', 'test.csv']) 1409s ret_code = 0 1409s 1409s @pytest.mark.parametrize( 1409s "command, ret_code", 1409s [ 1409s # Check the script doesn't raise an unexpected exception with badly formed 1409s # files. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "test/fixtures/cli/fail_many.sql", 1409s "-vvvvvvv", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix with a suffixs 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix without specifying rules 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Format 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format with --persist-timing 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s "--persist-timing", 1409s "test.csv", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format (specifying rules) 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Template syntax error in macro file 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test overriding library path when it doesn't cause an issue 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1409s ), 1409s 0, 1409s ), 1409s # Test overriding library path when it DOES cause an issue 1409s # (because macros won't be found). 1409s ( 1409s ( 1409s # Render because that's the step where the issue will 1409s # occur. 1409s render, 1409s [ 1409s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1409s "--library-path", 1409s "none", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test render fail 1409s ( 1409s ( 1409s render, 1409s ["test/fixtures/cli/fail_many.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test a longer lint fail with --bench 1409s # This tests the threshold rules clause 1409s ( 1409s ( 1409s lint, 1409s [ 1409s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1409s "--bench", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test that setting --quiet with --verbose raises an error. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--quiet", 1409s "--verbose", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Test machine format parse command with an unparsable file. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s # Test machine format parse command with a fatal templating error. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1409s """Check commands expecting a non-zero ret code.""" 1409s > invoke_assert_code(ret_code=ret_code, args=command) 1409s 1409s test/cli/commands_test.py:749: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['--fixed-suffix', '_fix', 'test/fixtures/linter/whitespace_errors.sql', '--persist-timing', 'test.csv']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ____________ test__cli__command_lint_parse_with_retcode[command5-2] ____________ 1409s 1409s command = (, ['--rules', 'LT01', '--fixed-suffix', '_fix', 'test/fixtures/linter/whitespace_errors.sql']) 1409s ret_code = 2 1409s 1409s @pytest.mark.parametrize( 1409s "command, ret_code", 1409s [ 1409s # Check the script doesn't raise an unexpected exception with badly formed 1409s # files. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "test/fixtures/cli/fail_many.sql", 1409s "-vvvvvvv", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix with a suffixs 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix without specifying rules 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Format 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format with --persist-timing 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s "--persist-timing", 1409s "test.csv", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format (specifying rules) 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Template syntax error in macro file 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test overriding library path when it doesn't cause an issue 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1409s ), 1409s 0, 1409s ), 1409s # Test overriding library path when it DOES cause an issue 1409s # (because macros won't be found). 1409s ( 1409s ( 1409s # Render because that's the step where the issue will 1409s # occur. 1409s render, 1409s [ 1409s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1409s "--library-path", 1409s "none", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test render fail 1409s ( 1409s ( 1409s render, 1409s ["test/fixtures/cli/fail_many.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test a longer lint fail with --bench 1409s # This tests the threshold rules clause 1409s ( 1409s ( 1409s lint, 1409s [ 1409s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1409s "--bench", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test that setting --quiet with --verbose raises an error. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--quiet", 1409s "--verbose", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Test machine format parse command with an unparsable file. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s # Test machine format parse command with a fatal templating error. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1409s """Check commands expecting a non-zero ret code.""" 1409s > invoke_assert_code(ret_code=ret_code, args=command) 1409s 1409s test/cli/commands_test.py:749: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 2 1409s args = (, ['--rules', 'LT01', '--fixed-suffix', '_fix', 'test/fixtures/linter/whitespace_errors.sql']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ____________ test__cli__command_lint_parse_with_retcode[command6-1] ____________ 1409s 1409s command = (, ['test/fixtures/cli/unknown_jinja_tag/test.sql']) 1409s ret_code = 1 1409s 1409s @pytest.mark.parametrize( 1409s "command, ret_code", 1409s [ 1409s # Check the script doesn't raise an unexpected exception with badly formed 1409s # files. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "test/fixtures/cli/fail_many.sql", 1409s "-vvvvvvv", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix with a suffixs 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix without specifying rules 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Format 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format with --persist-timing 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s "--persist-timing", 1409s "test.csv", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format (specifying rules) 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Template syntax error in macro file 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test overriding library path when it doesn't cause an issue 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1409s ), 1409s 0, 1409s ), 1409s # Test overriding library path when it DOES cause an issue 1409s # (because macros won't be found). 1409s ( 1409s ( 1409s # Render because that's the step where the issue will 1409s # occur. 1409s render, 1409s [ 1409s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1409s "--library-path", 1409s "none", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test render fail 1409s ( 1409s ( 1409s render, 1409s ["test/fixtures/cli/fail_many.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test a longer lint fail with --bench 1409s # This tests the threshold rules clause 1409s ( 1409s ( 1409s lint, 1409s [ 1409s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1409s "--bench", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test that setting --quiet with --verbose raises an error. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--quiet", 1409s "--verbose", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Test machine format parse command with an unparsable file. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s # Test machine format parse command with a fatal templating error. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1409s """Check commands expecting a non-zero ret code.""" 1409s > invoke_assert_code(ret_code=ret_code, args=command) 1409s 1409s test/cli/commands_test.py:749: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 1 1409s args = (, ['test/fixtures/cli/unknown_jinja_tag/test.sql']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ____________ test__cli__command_lint_parse_with_retcode[command7-0] ____________ 1409s 1409s command = (, ['test/fixtures/cli/passing_a.sql', '--library-path', 'none']) 1409s ret_code = 0 1409s 1409s @pytest.mark.parametrize( 1409s "command, ret_code", 1409s [ 1409s # Check the script doesn't raise an unexpected exception with badly formed 1409s # files. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "test/fixtures/cli/fail_many.sql", 1409s "-vvvvvvv", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix with a suffixs 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix without specifying rules 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Format 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format with --persist-timing 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s "--persist-timing", 1409s "test.csv", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format (specifying rules) 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Template syntax error in macro file 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test overriding library path when it doesn't cause an issue 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1409s ), 1409s 0, 1409s ), 1409s # Test overriding library path when it DOES cause an issue 1409s # (because macros won't be found). 1409s ( 1409s ( 1409s # Render because that's the step where the issue will 1409s # occur. 1409s render, 1409s [ 1409s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1409s "--library-path", 1409s "none", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test render fail 1409s ( 1409s ( 1409s render, 1409s ["test/fixtures/cli/fail_many.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test a longer lint fail with --bench 1409s # This tests the threshold rules clause 1409s ( 1409s ( 1409s lint, 1409s [ 1409s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1409s "--bench", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test that setting --quiet with --verbose raises an error. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--quiet", 1409s "--verbose", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Test machine format parse command with an unparsable file. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s # Test machine format parse command with a fatal templating error. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1409s """Check commands expecting a non-zero ret code.""" 1409s > invoke_assert_code(ret_code=ret_code, args=command) 1409s 1409s test/cli/commands_test.py:749: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = (, ['test/fixtures/cli/passing_a.sql', '--library-path', 'none']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ____________ test__cli__command_lint_parse_with_retcode[command8-1] ____________ 1409s 1409s command = (, ['test/fixtures/templater/jinja_r_library_in_macro/jinja.sql', '--library-path', 'none']) 1409s ret_code = 1 1409s 1409s @pytest.mark.parametrize( 1409s "command, ret_code", 1409s [ 1409s # Check the script doesn't raise an unexpected exception with badly formed 1409s # files. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "test/fixtures/cli/fail_many.sql", 1409s "-vvvvvvv", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix with a suffixs 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix without specifying rules 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Format 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format with --persist-timing 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s "--persist-timing", 1409s "test.csv", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format (specifying rules) 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Template syntax error in macro file 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test overriding library path when it doesn't cause an issue 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1409s ), 1409s 0, 1409s ), 1409s # Test overriding library path when it DOES cause an issue 1409s # (because macros won't be found). 1409s ( 1409s ( 1409s # Render because that's the step where the issue will 1409s # occur. 1409s render, 1409s [ 1409s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1409s "--library-path", 1409s "none", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test render fail 1409s ( 1409s ( 1409s render, 1409s ["test/fixtures/cli/fail_many.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test a longer lint fail with --bench 1409s # This tests the threshold rules clause 1409s ( 1409s ( 1409s lint, 1409s [ 1409s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1409s "--bench", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test that setting --quiet with --verbose raises an error. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--quiet", 1409s "--verbose", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Test machine format parse command with an unparsable file. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s # Test machine format parse command with a fatal templating error. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1409s """Check commands expecting a non-zero ret code.""" 1409s > invoke_assert_code(ret_code=ret_code, args=command) 1409s 1409s test/cli/commands_test.py:749: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 1 1409s args = (, ['test/fixtures/templater/jinja_r_library_in_macro/jinja.sql', '--library-path', 'none']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ____________ test__cli__command_lint_parse_with_retcode[command9-1] ____________ 1409s 1409s command = (, ['test/fixtures/cli/fail_many.sql']), ret_code = 1 1409s 1409s @pytest.mark.parametrize( 1409s "command, ret_code", 1409s [ 1409s # Check the script doesn't raise an unexpected exception with badly formed 1409s # files. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "test/fixtures/cli/fail_many.sql", 1409s "-vvvvvvv", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix with a suffixs 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix without specifying rules 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Format 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format with --persist-timing 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s "--persist-timing", 1409s "test.csv", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format (specifying rules) 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Template syntax error in macro file 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test overriding library path when it doesn't cause an issue 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1409s ), 1409s 0, 1409s ), 1409s # Test overriding library path when it DOES cause an issue 1409s # (because macros won't be found). 1409s ( 1409s ( 1409s # Render because that's the step where the issue will 1409s # occur. 1409s render, 1409s [ 1409s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1409s "--library-path", 1409s "none", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test render fail 1409s ( 1409s ( 1409s render, 1409s ["test/fixtures/cli/fail_many.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test a longer lint fail with --bench 1409s # This tests the threshold rules clause 1409s ( 1409s ( 1409s lint, 1409s [ 1409s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1409s "--bench", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test that setting --quiet with --verbose raises an error. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--quiet", 1409s "--verbose", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Test machine format parse command with an unparsable file. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s # Test machine format parse command with a fatal templating error. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1409s """Check commands expecting a non-zero ret code.""" 1409s > invoke_assert_code(ret_code=ret_code, args=command) 1409s 1409s test/cli/commands_test.py:749: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 1, args = (, ['test/fixtures/cli/fail_many.sql']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________ test__cli__command_lint_parse_with_retcode[command10-1] ____________ 1409s 1409s command = (, ['test/fixtures/linter/autofix/bigquery/004_templating/before.sql', '--bench']) 1409s ret_code = 1 1409s 1409s @pytest.mark.parametrize( 1409s "command, ret_code", 1409s [ 1409s # Check the script doesn't raise an unexpected exception with badly formed 1409s # files. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "test/fixtures/cli/fail_many.sql", 1409s "-vvvvvvv", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix with a suffixs 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix without specifying rules 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Format 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format with --persist-timing 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s "--persist-timing", 1409s "test.csv", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format (specifying rules) 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Template syntax error in macro file 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test overriding library path when it doesn't cause an issue 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1409s ), 1409s 0, 1409s ), 1409s # Test overriding library path when it DOES cause an issue 1409s # (because macros won't be found). 1409s ( 1409s ( 1409s # Render because that's the step where the issue will 1409s # occur. 1409s render, 1409s [ 1409s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1409s "--library-path", 1409s "none", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test render fail 1409s ( 1409s ( 1409s render, 1409s ["test/fixtures/cli/fail_many.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test a longer lint fail with --bench 1409s # This tests the threshold rules clause 1409s ( 1409s ( 1409s lint, 1409s [ 1409s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1409s "--bench", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test that setting --quiet with --verbose raises an error. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--quiet", 1409s "--verbose", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Test machine format parse command with an unparsable file. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s # Test machine format parse command with a fatal templating error. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1409s """Check commands expecting a non-zero ret code.""" 1409s > invoke_assert_code(ret_code=ret_code, args=command) 1409s 1409s test/cli/commands_test.py:749: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 1 1409s args = (, ['test/fixtures/linter/autofix/bigquery/004_templating/before.sql', '--bench']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________ test__cli__command_lint_parse_with_retcode[command11-2] ____________ 1409s 1409s command = (, ['--quiet', '--verbose', 'test/fixtures/cli/fail_many.sql']) 1409s ret_code = 2 1409s 1409s @pytest.mark.parametrize( 1409s "command, ret_code", 1409s [ 1409s # Check the script doesn't raise an unexpected exception with badly formed 1409s # files. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "test/fixtures/cli/fail_many.sql", 1409s "-vvvvvvv", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix with a suffixs 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix without specifying rules 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Format 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format with --persist-timing 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s "--persist-timing", 1409s "test.csv", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format (specifying rules) 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Template syntax error in macro file 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test overriding library path when it doesn't cause an issue 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1409s ), 1409s 0, 1409s ), 1409s # Test overriding library path when it DOES cause an issue 1409s # (because macros won't be found). 1409s ( 1409s ( 1409s # Render because that's the step where the issue will 1409s # occur. 1409s render, 1409s [ 1409s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1409s "--library-path", 1409s "none", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test render fail 1409s ( 1409s ( 1409s render, 1409s ["test/fixtures/cli/fail_many.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test a longer lint fail with --bench 1409s # This tests the threshold rules clause 1409s ( 1409s ( 1409s lint, 1409s [ 1409s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1409s "--bench", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test that setting --quiet with --verbose raises an error. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--quiet", 1409s "--verbose", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Test machine format parse command with an unparsable file. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s # Test machine format parse command with a fatal templating error. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1409s """Check commands expecting a non-zero ret code.""" 1409s > invoke_assert_code(ret_code=ret_code, args=command) 1409s 1409s test/cli/commands_test.py:749: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 2 1409s args = (, ['--quiet', '--verbose', 'test/fixtures/cli/fail_many.sql']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________ test__cli__command_lint_parse_with_retcode[command12-1] ____________ 1409s 1409s command = (, ['test/fixtures/linter/parse_lex_error.sql', '-f', 'yaml']) 1409s ret_code = 1 1409s 1409s @pytest.mark.parametrize( 1409s "command, ret_code", 1409s [ 1409s # Check the script doesn't raise an unexpected exception with badly formed 1409s # files. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "test/fixtures/cli/fail_many.sql", 1409s "-vvvvvvv", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix with a suffixs 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix without specifying rules 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Format 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format with --persist-timing 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s "--persist-timing", 1409s "test.csv", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format (specifying rules) 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Template syntax error in macro file 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test overriding library path when it doesn't cause an issue 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1409s ), 1409s 0, 1409s ), 1409s # Test overriding library path when it DOES cause an issue 1409s # (because macros won't be found). 1409s ( 1409s ( 1409s # Render because that's the step where the issue will 1409s # occur. 1409s render, 1409s [ 1409s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1409s "--library-path", 1409s "none", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test render fail 1409s ( 1409s ( 1409s render, 1409s ["test/fixtures/cli/fail_many.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test a longer lint fail with --bench 1409s # This tests the threshold rules clause 1409s ( 1409s ( 1409s lint, 1409s [ 1409s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1409s "--bench", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test that setting --quiet with --verbose raises an error. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--quiet", 1409s "--verbose", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Test machine format parse command with an unparsable file. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s # Test machine format parse command with a fatal templating error. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1409s """Check commands expecting a non-zero ret code.""" 1409s > invoke_assert_code(ret_code=ret_code, args=command) 1409s 1409s test/cli/commands_test.py:749: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 1 1409s args = (, ['test/fixtures/linter/parse_lex_error.sql', '-f', 'yaml']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________ test__cli__command_lint_parse_with_retcode[command13-1] ____________ 1409s 1409s command = (, ['test/fixtures/cli/jinja_fatal_fail.sql', '-f', 'yaml']) 1409s ret_code = 1 1409s 1409s @pytest.mark.parametrize( 1409s "command, ret_code", 1409s [ 1409s # Check the script doesn't raise an unexpected exception with badly formed 1409s # files. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "test/fixtures/cli/fail_many.sql", 1409s "-vvvvvvv", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix with a suffixs 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Fix without specifying rules 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Format 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format with --persist-timing 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s "--persist-timing", 1409s "test.csv", 1409s ], 1409s ), 1409s 0, 1409s ), 1409s # Format (specifying rules) 1409s ( 1409s ( 1409s cli_format, 1409s [ 1409s "--rules", 1409s "LT01", 1409s "--fixed-suffix", 1409s "_fix", 1409s "test/fixtures/linter/whitespace_errors.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Template syntax error in macro file 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test overriding library path when it doesn't cause an issue 1409s ( 1409s ( 1409s lint, 1409s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1409s ), 1409s 0, 1409s ), 1409s # Test overriding library path when it DOES cause an issue 1409s # (because macros won't be found). 1409s ( 1409s ( 1409s # Render because that's the step where the issue will 1409s # occur. 1409s render, 1409s [ 1409s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1409s "--library-path", 1409s "none", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test render fail 1409s ( 1409s ( 1409s render, 1409s ["test/fixtures/cli/fail_many.sql"], 1409s ), 1409s 1, 1409s ), 1409s # Test a longer lint fail with --bench 1409s # This tests the threshold rules clause 1409s ( 1409s ( 1409s lint, 1409s [ 1409s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1409s "--bench", 1409s ], 1409s ), 1409s 1, 1409s ), 1409s # Test that setting --quiet with --verbose raises an error. 1409s ( 1409s ( 1409s fix, 1409s [ 1409s "--quiet", 1409s "--verbose", 1409s "test/fixtures/cli/fail_many.sql", 1409s ], 1409s ), 1409s 2, 1409s ), 1409s # Test machine format parse command with an unparsable file. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s # Test machine format parse command with a fatal templating error. 1409s ( 1409s ( 1409s parse, 1409s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1409s ), 1409s 1, 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1409s """Check commands expecting a non-zero ret code.""" 1409s > invoke_assert_code(ret_code=ret_code, args=command) 1409s 1409s test/cli/commands_test.py:749: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 1 1409s args = (, ['test/fixtures/cli/jinja_fatal_fail.sql', '-f', 'yaml']) 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___________________________ test__cli__command_rules ___________________________ 1409s 1409s def test__cli__command_rules(): 1409s """Check rules command for exceptions.""" 1409s > invoke_assert_code(args=[rules]) 1409s 1409s test/cli/commands_test.py:893: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0, args = [], kwargs = {}, cli_input = None 1409s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s _________________________ test__cli__command_dialects __________________________ 1409s 1409s def test__cli__command_dialects(): 1409s """Check dialects command for exceptions.""" 1409s > invoke_assert_code(args=[dialects]) 1409s 1409s test/cli/commands_test.py:898: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0, args = [], kwargs = {}, cli_input = None 1409s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s __ test__cli__command__fix[LT01-test/fixtures/linter/indentation_errors.sql0] __ 1409s 1409s rule = 'LT01', fname = 'test/fixtures/linter/indentation_errors.sql' 1409s 1409s @pytest.mark.parametrize( 1409s "rule,fname", 1409s [ 1409s ("LT01", "test/fixtures/linter/indentation_errors.sql"), 1409s ("LT01", "test/fixtures/linter/whitespace_errors.sql"), 1409s ("LT01", "test/fixtures/linter/indentation_errors.sql"), 1409s # Really stretching the ability of the fixer to re-indent a file 1409s ("LT02", "test/fixtures/linter/indentation_error_hard.sql"), 1409s ], 1409s ) 1409s def test__cli__command__fix(rule, fname): 1409s """Test the round trip of detecting, fixing and then not detecting the rule.""" 1409s with open(fname) as test_file: 1409s > generic_roundtrip_test(test_file, rule) 1409s 1409s test/cli/commands_test.py:972: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s test/cli/commands_test.py:928: in generic_roundtrip_test 1409s invoke_assert_code( 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 1 1409s args = [, ['--dialect=ansi', '--rules', 'LT01', '/tmp/tmpcmk5sd8u/testing.sql']] 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ___ test__cli__command__fix[LT01-test/fixtures/linter/whitespace_errors.sql] ___ 1409s 1409s rule = 'LT01', fname = 'test/fixtures/linter/whitespace_errors.sql' 1409s 1409s @pytest.mark.parametrize( 1409s "rule,fname", 1409s [ 1409s ("LT01", "test/fixtures/linter/indentation_errors.sql"), 1409s ("LT01", "test/fixtures/linter/whitespace_errors.sql"), 1409s ("LT01", "test/fixtures/linter/indentation_errors.sql"), 1409s # Really stretching the ability of the fixer to re-indent a file 1409s ("LT02", "test/fixtures/linter/indentation_error_hard.sql"), 1409s ], 1409s ) 1409s def test__cli__command__fix(rule, fname): 1409s """Test the round trip of detecting, fixing and then not detecting the rule.""" 1409s with open(fname) as test_file: 1409s > generic_roundtrip_test(test_file, rule) 1409s 1409s test/cli/commands_test.py:972: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s test/cli/commands_test.py:928: in generic_roundtrip_test 1409s invoke_assert_code( 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 1 1409s args = [, ['--dialect=ansi', '--rules', 'LT01', '/tmp/tmp9meofw1k/testing.sql']] 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s __ test__cli__command__fix[LT01-test/fixtures/linter/indentation_errors.sql1] __ 1409s 1409s rule = 'LT01', fname = 'test/fixtures/linter/indentation_errors.sql' 1409s 1409s @pytest.mark.parametrize( 1409s "rule,fname", 1409s [ 1409s ("LT01", "test/fixtures/linter/indentation_errors.sql"), 1409s ("LT01", "test/fixtures/linter/whitespace_errors.sql"), 1409s ("LT01", "test/fixtures/linter/indentation_errors.sql"), 1409s # Really stretching the ability of the fixer to re-indent a file 1409s ("LT02", "test/fixtures/linter/indentation_error_hard.sql"), 1409s ], 1409s ) 1409s def test__cli__command__fix(rule, fname): 1409s """Test the round trip of detecting, fixing and then not detecting the rule.""" 1409s with open(fname) as test_file: 1409s > generic_roundtrip_test(test_file, rule) 1409s 1409s test/cli/commands_test.py:972: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s test/cli/commands_test.py:928: in generic_roundtrip_test 1409s invoke_assert_code( 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 1 1409s args = [, ['--dialect=ansi', '--rules', 'LT01', '/tmp/tmp7cuo9nwg/testing.sql']] 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s _ test__cli__command__fix[LT02-test/fixtures/linter/indentation_error_hard.sql] _ 1409s 1409s rule = 'LT02', fname = 'test/fixtures/linter/indentation_error_hard.sql' 1409s 1409s @pytest.mark.parametrize( 1409s "rule,fname", 1409s [ 1409s ("LT01", "test/fixtures/linter/indentation_errors.sql"), 1409s ("LT01", "test/fixtures/linter/whitespace_errors.sql"), 1409s ("LT01", "test/fixtures/linter/indentation_errors.sql"), 1409s # Really stretching the ability of the fixer to re-indent a file 1409s ("LT02", "test/fixtures/linter/indentation_error_hard.sql"), 1409s ], 1409s ) 1409s def test__cli__command__fix(rule, fname): 1409s """Test the round trip of detecting, fixing and then not detecting the rule.""" 1409s with open(fname) as test_file: 1409s > generic_roundtrip_test(test_file, rule) 1409s 1409s test/cli/commands_test.py:972: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s test/cli/commands_test.py:928: in generic_roundtrip_test 1409s invoke_assert_code( 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 1 1409s args = [, ['--dialect=ansi', '--rules', 'LT02', '/tmp/tmpjpfjsrb9/testing.sql']] 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s _______________ test_cli_fix_even_unparsable[command-line-False] _______________ 1409s 1409s method = 'command-line', fix_even_unparsable = False 1409s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7426c9f1af90> 1409s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_cli_fix_even_unparsable_c0') 1409s 1409s @pytest.mark.parametrize( 1409s "method,fix_even_unparsable", 1409s [ 1409s ("command-line", False), 1409s ("command-line", True), 1409s ("config-file", False), 1409s ("config-file", True), 1409s ], 1409s ) 1409s def test_cli_fix_even_unparsable( 1409s method: str, fix_even_unparsable: bool, monkeypatch, tmpdir 1409s ): 1409s """Test the fix_even_unparsable option works from cmd line and config.""" 1409s sql_filename = "fix_even_unparsable.sql" 1409s sql_path = str(tmpdir / sql_filename) 1409s with open(sql_path, "w") as f: 1409s print( 1409s """SELECT my_col 1409s FROM my_schema.my_table 1409s where processdate ! 3 1409s """, 1409s file=f, 1409s ) 1409s options = [ 1409s "--dialect", 1409s "ansi", 1409s "--fixed-suffix=FIXED", 1409s sql_path, 1409s ] 1409s if method == "command-line": 1409s if fix_even_unparsable: 1409s options.append("--FIX-EVEN-UNPARSABLE") 1409s else: 1409s assert method == "config-file" 1409s with open(str(tmpdir / ".sqlfluff"), "w") as f: 1409s print( 1409s f"[sqlfluff]\nfix_even_unparsable = {fix_even_unparsable}", 1409s file=f, 1409s ) 1409s # TRICKY: Switch current directory to the one with the SQL file. Otherwise, 1409s # the setting doesn't work. That's because SQLFluff reads it in 1409s # sqlfluff.cli.commands.fix(), prior to reading any file-specific settings 1409s # (down in sqlfluff.core.linter.Linter._load_raw_file_and_config()). 1409s monkeypatch.chdir(str(tmpdir)) 1409s > invoke_assert_code( 1409s ret_code=0 if fix_even_unparsable else 1, 1409s args=[ 1409s fix, 1409s options, 1409s ], 1409s ) 1409s 1409s /tmp/autopkgtest.KLm779/autopkgtest_tmp/test/cli/commands_test.py:1178: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 1 1409s args = [, ['--dialect', 'ansi', '--fixed-suffix=FIXED', '/tmp/pytest-of-ubuntu/pytest-0/test_cli_fix_even_unparsable_c0/fix_even_unparsable.sql']] 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s _______________ test_cli_fix_even_unparsable[command-line-True] ________________ 1409s 1409s method = 'command-line', fix_even_unparsable = True 1409s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7426c9f19d30> 1409s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_cli_fix_even_unparsable_c1') 1409s 1409s @pytest.mark.parametrize( 1409s "method,fix_even_unparsable", 1409s [ 1409s ("command-line", False), 1409s ("command-line", True), 1409s ("config-file", False), 1409s ("config-file", True), 1409s ], 1409s ) 1409s def test_cli_fix_even_unparsable( 1409s method: str, fix_even_unparsable: bool, monkeypatch, tmpdir 1409s ): 1409s """Test the fix_even_unparsable option works from cmd line and config.""" 1409s sql_filename = "fix_even_unparsable.sql" 1409s sql_path = str(tmpdir / sql_filename) 1409s with open(sql_path, "w") as f: 1409s print( 1409s """SELECT my_col 1409s FROM my_schema.my_table 1409s where processdate ! 3 1409s """, 1409s file=f, 1409s ) 1409s options = [ 1409s "--dialect", 1409s "ansi", 1409s "--fixed-suffix=FIXED", 1409s sql_path, 1409s ] 1409s if method == "command-line": 1409s if fix_even_unparsable: 1409s options.append("--FIX-EVEN-UNPARSABLE") 1409s else: 1409s assert method == "config-file" 1409s with open(str(tmpdir / ".sqlfluff"), "w") as f: 1409s print( 1409s f"[sqlfluff]\nfix_even_unparsable = {fix_even_unparsable}", 1409s file=f, 1409s ) 1409s # TRICKY: Switch current directory to the one with the SQL file. Otherwise, 1409s # the setting doesn't work. That's because SQLFluff reads it in 1409s # sqlfluff.cli.commands.fix(), prior to reading any file-specific settings 1409s # (down in sqlfluff.core.linter.Linter._load_raw_file_and_config()). 1409s monkeypatch.chdir(str(tmpdir)) 1409s > invoke_assert_code( 1409s ret_code=0 if fix_even_unparsable else 1, 1409s args=[ 1409s fix, 1409s options, 1409s ], 1409s ) 1409s 1409s /tmp/autopkgtest.KLm779/autopkgtest_tmp/test/cli/commands_test.py:1178: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = [, ['--dialect', 'ansi', '--fixed-suffix=FIXED', '/tmp/pytest-of-ubuntu/pytest-0/test_cli_fix_even_unparsable_c1/fix_even_unparsable.sql', '--FIX-EVEN-UNPARSABLE']] 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s _______________ test_cli_fix_even_unparsable[config-file-False] ________________ 1409s 1409s method = 'config-file', fix_even_unparsable = False 1409s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7426c9f18320> 1409s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_cli_fix_even_unparsable_c2') 1409s 1409s @pytest.mark.parametrize( 1409s "method,fix_even_unparsable", 1409s [ 1409s ("command-line", False), 1409s ("command-line", True), 1409s ("config-file", False), 1409s ("config-file", True), 1409s ], 1409s ) 1409s def test_cli_fix_even_unparsable( 1409s method: str, fix_even_unparsable: bool, monkeypatch, tmpdir 1409s ): 1409s """Test the fix_even_unparsable option works from cmd line and config.""" 1409s sql_filename = "fix_even_unparsable.sql" 1409s sql_path = str(tmpdir / sql_filename) 1409s with open(sql_path, "w") as f: 1409s print( 1409s """SELECT my_col 1409s FROM my_schema.my_table 1409s where processdate ! 3 1409s """, 1409s file=f, 1409s ) 1409s options = [ 1409s "--dialect", 1409s "ansi", 1409s "--fixed-suffix=FIXED", 1409s sql_path, 1409s ] 1409s if method == "command-line": 1409s if fix_even_unparsable: 1409s options.append("--FIX-EVEN-UNPARSABLE") 1409s else: 1409s assert method == "config-file" 1409s with open(str(tmpdir / ".sqlfluff"), "w") as f: 1409s print( 1409s f"[sqlfluff]\nfix_even_unparsable = {fix_even_unparsable}", 1409s file=f, 1409s ) 1409s # TRICKY: Switch current directory to the one with the SQL file. Otherwise, 1409s # the setting doesn't work. That's because SQLFluff reads it in 1409s # sqlfluff.cli.commands.fix(), prior to reading any file-specific settings 1409s # (down in sqlfluff.core.linter.Linter._load_raw_file_and_config()). 1409s monkeypatch.chdir(str(tmpdir)) 1409s > invoke_assert_code( 1409s ret_code=0 if fix_even_unparsable else 1, 1409s args=[ 1409s fix, 1409s options, 1409s ], 1409s ) 1409s 1409s /tmp/autopkgtest.KLm779/autopkgtest_tmp/test/cli/commands_test.py:1178: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 1 1409s args = [, ['--dialect', 'ansi', '--fixed-suffix=FIXED', '/tmp/pytest-of-ubuntu/pytest-0/test_cli_fix_even_unparsable_c2/fix_even_unparsable.sql']] 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ________________ test_cli_fix_even_unparsable[config-file-True] ________________ 1409s 1409s method = 'config-file', fix_even_unparsable = True 1409s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7426c9f070b0> 1409s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_cli_fix_even_unparsable_c3') 1409s 1409s @pytest.mark.parametrize( 1409s "method,fix_even_unparsable", 1409s [ 1409s ("command-line", False), 1409s ("command-line", True), 1409s ("config-file", False), 1409s ("config-file", True), 1409s ], 1409s ) 1409s def test_cli_fix_even_unparsable( 1409s method: str, fix_even_unparsable: bool, monkeypatch, tmpdir 1409s ): 1409s """Test the fix_even_unparsable option works from cmd line and config.""" 1409s sql_filename = "fix_even_unparsable.sql" 1409s sql_path = str(tmpdir / sql_filename) 1409s with open(sql_path, "w") as f: 1409s print( 1409s """SELECT my_col 1409s FROM my_schema.my_table 1409s where processdate ! 3 1409s """, 1409s file=f, 1409s ) 1409s options = [ 1409s "--dialect", 1409s "ansi", 1409s "--fixed-suffix=FIXED", 1409s sql_path, 1409s ] 1409s if method == "command-line": 1409s if fix_even_unparsable: 1409s options.append("--FIX-EVEN-UNPARSABLE") 1409s else: 1409s assert method == "config-file" 1409s with open(str(tmpdir / ".sqlfluff"), "w") as f: 1409s print( 1409s f"[sqlfluff]\nfix_even_unparsable = {fix_even_unparsable}", 1409s file=f, 1409s ) 1409s # TRICKY: Switch current directory to the one with the SQL file. Otherwise, 1409s # the setting doesn't work. That's because SQLFluff reads it in 1409s # sqlfluff.cli.commands.fix(), prior to reading any file-specific settings 1409s # (down in sqlfluff.core.linter.Linter._load_raw_file_and_config()). 1409s monkeypatch.chdir(str(tmpdir)) 1409s > invoke_assert_code( 1409s ret_code=0 if fix_even_unparsable else 1, 1409s args=[ 1409s fix, 1409s options, 1409s ], 1409s ) 1409s 1409s /tmp/autopkgtest.KLm779/autopkgtest_tmp/test/cli/commands_test.py:1178: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = [, ['--dialect', 'ansi', '--fixed-suffix=FIXED', '/tmp/pytest-of-ubuntu/pytest-0/test_cli_fix_even_unparsable_c3/fix_even_unparsable.sql']] 1409s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1409s raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s ______ test__cli__command_fix_stdin[select * from t-LT02-select * from t] ______ 1409s 1409s stdin = 'select * from t', rules = 'LT02', stdout = 'select * from t' 1409s 1409s @pytest.mark.parametrize( 1409s "stdin,rules,stdout", 1409s [ 1409s ("select * from t", "LT02", "select * from t"), # no change 1409s ( 1409s " select * from t", 1409s "LT02", 1409s "select * from t", 1409s ), # fix preceding whitespace 1409s ], 1409s ) 1409s def test__cli__command_fix_stdin(stdin, rules, stdout): 1409s """Check stdin input for fix works.""" 1409s > result = invoke_assert_code( 1409s args=[ 1409s fix, 1409s ("-", "--rules", rules, "--disable-progress-bar", "--dialect=ansi"), 1409s ], 1409s cli_input=stdin, 1409s ) 1409s 1409s test/cli/commands_test.py:1213: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = [, ('-', '--rules', 'LT02', '--disable-progress-bar', '--dialect=ansi')] 1409s kwargs = {'input': 'select * from t'}, cli_input = 'select * from t' 1409s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s _____ test__cli__command_fix_stdin[ select * from t-LT02-select * from t] ______ 1409s 1409s stdin = ' select * from t', rules = 'LT02', stdout = 'select * from t' 1409s 1409s @pytest.mark.parametrize( 1409s "stdin,rules,stdout", 1409s [ 1409s ("select * from t", "LT02", "select * from t"), # no change 1409s ( 1409s " select * from t", 1409s "LT02", 1409s "select * from t", 1409s ), # fix preceding whitespace 1409s ], 1409s ) 1409s def test__cli__command_fix_stdin(stdin, rules, stdout): 1409s """Check stdin input for fix works.""" 1409s > result = invoke_assert_code( 1409s args=[ 1409s fix, 1409s ("-", "--rules", rules, "--disable-progress-bar", "--dialect=ansi"), 1409s ], 1409s cli_input=stdin, 1409s ) 1409s 1409s test/cli/commands_test.py:1213: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = [, ('-', '--rules', 'LT02', '--disable-progress-bar', '--dialect=ansi')] 1409s kwargs = {'input': ' select * from t'}, cli_input = ' select * from t' 1409s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s _____ test__cli__command_format_stdin[select * from t\n-select * from t\n] _____ 1409s 1409s stdin = 'select * from t\n', stdout = 'select * from t\n' 1409s 1409s @pytest.mark.parametrize( 1409s "stdin,stdout", 1409s [ 1409s ("select * from t\n", "select * from t\n"), # no change 1409s ( 1409s " select * FRoM t ", 1409s "select * from t\n", 1409s ), 1409s ( 1409s # Check that warnings related to parsing errors on input don't 1409s # go to stdout. This query shouldn't change, but stdout should 1409s # remain clean. 1409s # https://github.com/sqlfluff/sqlfluff/issues/5327 1409s "select\n" 1409s " count(*) over (\n" 1409s " order by a desc \n" 1409s " range between b row and '10 seconds' following -- noqa: PRS\n" 1409s " ) as c\n" 1409s "from d\n", 1409s "select\n" 1409s " count(*) over (\n" 1409s " order by a desc \n" 1409s " range between b row and '10 seconds' following -- noqa: PRS\n" 1409s " ) as c\n" 1409s "from d\n", 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_format_stdin(stdin, stdout): 1409s """Check stdin input for fix works.""" 1409s > result = invoke_assert_code( 1409s args=[ 1409s cli_format, 1409s ("-", "--disable-progress-bar", "--dialect=ansi"), 1409s ], 1409s cli_input=stdin, 1409s mix_stderr=False, 1409s ) 1409s 1409s test/cli/commands_test.py:1253: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = [, ('-', '--disable-progress-bar', '--dialect=ansi')] 1409s kwargs = {'input': 'select * from t\n'}, cli_input = 'select * from t\n' 1409s mix_stderr = False, assert_output_contains = '', raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1409s kwargs: Optional[Dict[str, Any]] = None, 1409s cli_input: Optional[str] = None, 1409s mix_stderr: bool = True, 1409s assert_output_contains: str = "", 1409s raise_exceptions: bool = True, 1409s ) -> Result: 1409s """Invoke a command and check return code.""" 1409s args = args or [] 1409s kwargs = kwargs or {} 1409s if cli_input: 1409s kwargs["input"] = cli_input 1409s > runner = CliRunner(mix_stderr=mix_stderr) 1409s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1409s 1409s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1409s _ test__cli__command_format_stdin[ select * FRoM t -select * from t\n] _ 1409s 1409s stdin = ' select * FRoM t ', stdout = 'select * from t\n' 1409s 1409s @pytest.mark.parametrize( 1409s "stdin,stdout", 1409s [ 1409s ("select * from t\n", "select * from t\n"), # no change 1409s ( 1409s " select * FRoM t ", 1409s "select * from t\n", 1409s ), 1409s ( 1409s # Check that warnings related to parsing errors on input don't 1409s # go to stdout. This query shouldn't change, but stdout should 1409s # remain clean. 1409s # https://github.com/sqlfluff/sqlfluff/issues/5327 1409s "select\n" 1409s " count(*) over (\n" 1409s " order by a desc \n" 1409s " range between b row and '10 seconds' following -- noqa: PRS\n" 1409s " ) as c\n" 1409s "from d\n", 1409s "select\n" 1409s " count(*) over (\n" 1409s " order by a desc \n" 1409s " range between b row and '10 seconds' following -- noqa: PRS\n" 1409s " ) as c\n" 1409s "from d\n", 1409s ), 1409s ], 1409s ) 1409s def test__cli__command_format_stdin(stdin, stdout): 1409s """Check stdin input for fix works.""" 1409s > result = invoke_assert_code( 1409s args=[ 1409s cli_format, 1409s ("-", "--disable-progress-bar", "--dialect=ansi"), 1409s ], 1409s cli_input=stdin, 1409s mix_stderr=False, 1409s ) 1409s 1409s test/cli/commands_test.py:1253: 1409s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1409s 1409s ret_code = 0 1409s args = [, ('-', '--disable-progress-bar', '--dialect=ansi')] 1409s kwargs = {'input': ' select * FRoM t '} 1409s cli_input = ' select * FRoM t ', mix_stderr = False 1409s assert_output_contains = '', raise_exceptions = True 1409s 1409s def invoke_assert_code( 1409s ret_code: int = 0, 1409s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _ test__cli__command_format_stdin[select\n count(*) over (\n order by a desc \n range between b row and '10 seconds' following -- noqa: PRS\n ) as c\nfrom d\n-select\n count(*) over (\n order by a desc \n range between b row and '10 seconds' following -- noqa: PRS\n ) as c\nfrom d\n] _ 1410s 1410s stdin = "select\n count(*) over (\n order by a desc \n range between b row and '10 seconds' following -- noqa: PRS\n ) as c\nfrom d\n" 1410s stdout = "select\n count(*) over (\n order by a desc \n range between b row and '10 seconds' following -- noqa: PRS\n ) as c\nfrom d\n" 1410s 1410s @pytest.mark.parametrize( 1410s "stdin,stdout", 1410s [ 1410s ("select * from t\n", "select * from t\n"), # no change 1410s ( 1410s " select * FRoM t ", 1410s "select * from t\n", 1410s ), 1410s ( 1410s # Check that warnings related to parsing errors on input don't 1410s # go to stdout. This query shouldn't change, but stdout should 1410s # remain clean. 1410s # https://github.com/sqlfluff/sqlfluff/issues/5327 1410s "select\n" 1410s " count(*) over (\n" 1410s " order by a desc \n" 1410s " range between b row and '10 seconds' following -- noqa: PRS\n" 1410s " ) as c\n" 1410s "from d\n", 1410s "select\n" 1410s " count(*) over (\n" 1410s " order by a desc \n" 1410s " range between b row and '10 seconds' following -- noqa: PRS\n" 1410s " ) as c\n" 1410s "from d\n", 1410s ), 1410s ], 1410s ) 1410s def test__cli__command_format_stdin(stdin, stdout): 1410s """Check stdin input for fix works.""" 1410s > result = invoke_assert_code( 1410s args=[ 1410s cli_format, 1410s ("-", "--disable-progress-bar", "--dialect=ansi"), 1410s ], 1410s cli_input=stdin, 1410s mix_stderr=False, 1410s ) 1410s 1410s test/cli/commands_test.py:1253: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 0 1410s args = [, ('-', '--disable-progress-bar', '--dialect=ansi')] 1410s kwargs = {'input': "select\n count(*) over (\n order by a desc \n range between b row and '10 seconds' following -- noqa: PRS\n ) as c\nfrom d\n"} 1410s cli_input = "select\n count(*) over (\n order by a desc \n range between b row and '10 seconds' following -- noqa: PRS\n ) as c\nfrom d\n" 1410s mix_stderr = False, assert_output_contains = '', raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s ________________ test__cli__command_fix_stdin_logging_to_stderr ________________ 1410s 1410s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7426c9f05760> 1410s 1410s def test__cli__command_fix_stdin_logging_to_stderr(monkeypatch): 1410s """Check that logging goes to stderr when stdin is passed to fix.""" 1410s perfect_sql = "select col from table" 1410s 1410s class MockLinter(sqlfluff.core.Linter): 1410s @classmethod 1410s def lint_fix_parsed(cls, *args, **kwargs): 1410s cls._warn_unfixable("") 1410s return super().lint_fix_parsed(*args, **kwargs) 1410s 1410s monkeypatch.setattr(sqlfluff.cli.commands, "Linter", MockLinter) 1410s > result = invoke_assert_code( 1410s args=[fix, ("-", "--rules=LT02", "--dialect=ansi")], 1410s cli_input=perfect_sql, 1410s mix_stderr=False, 1410s ) 1410s 1410s test/cli/commands_test.py:1275: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 0, args = [, ('-', '--rules=LT02', '--dialect=ansi')] 1410s kwargs = {'input': 'select col from table'}, cli_input = 'select col from table' 1410s mix_stderr = False, assert_output_contains = '', raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _____________________ test__cli__command_fix_stdin_safety ______________________ 1410s 1410s def test__cli__command_fix_stdin_safety(): 1410s """Check edge cases regarding safety when fixing stdin.""" 1410s perfect_sql = "select col from table" 1410s 1410s # just prints the very same thing 1410s > result = invoke_assert_code( 1410s args=[fix, ("-", "--disable-progress-bar", "--dialect=ansi")], 1410s cli_input=perfect_sql, 1410s ) 1410s 1410s test/cli/commands_test.py:1290: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 0 1410s args = [, ('-', '--disable-progress-bar', '--dialect=ansi')] 1410s kwargs = {'input': 'select col from table'}, cli_input = 'select col from table' 1410s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _ test__cli__command_fix_stdin_error_exit_code[create TABLE {{ params.dsfsdfds }}.t (a int)-1--v-Fix aborted due to unparsable template variables.] _ 1410s 1410s sql = 'create TABLE {{ params.dsfsdfds }}.t (a int)', exit_code = 1 1410s params = '-v' 1410s assert_output_contains = 'Fix aborted due to unparsable template variables.' 1410s 1410s @pytest.mark.parametrize( 1410s "sql,exit_code,params,assert_output_contains", 1410s [ 1410s ( 1410s "create TABLE {{ params.dsfsdfds }}.t (a int)", 1410s 1, 1410s "-v", 1410s "Fix aborted due to unparsable template variables.", 1410s ), # template error 1410s ("create TABLE a.t (a int)", 0, "", ""), # fixable error 1410s ("create table a.t (a int)", 0, "", ""), # perfection 1410s ( 1410s "select col from a join b using (c)", 1410s 1, 1410s "-v", 1410s "Unfixable violations detected.", 1410s ), # unfixable error (using) 1410s ], 1410s ) 1410s def test__cli__command_fix_stdin_error_exit_code( 1410s sql, exit_code, params, assert_output_contains 1410s ): 1410s """Check that the CLI fails nicely if fixing a templated stdin.""" 1410s > invoke_assert_code( 1410s ret_code=exit_code, 1410s args=[fix, ((params,) if params else ()) + ("--dialect=ansi", "-")], 1410s cli_input=sql, 1410s assert_output_contains=assert_output_contains, 1410s ) 1410s 1410s test/cli/commands_test.py:1320: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1, args = [, ('-v', '--dialect=ansi', '-')] 1410s kwargs = {'input': 'create TABLE {{ params.dsfsdfds }}.t (a int)'} 1410s cli_input = 'create TABLE {{ params.dsfsdfds }}.t (a int)', mix_stderr = True 1410s assert_output_contains = 'Fix aborted due to unparsable template variables.' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s __ test__cli__command_fix_stdin_error_exit_code[create TABLE a.t (a int)-0--] __ 1410s 1410s sql = 'create TABLE a.t (a int)', exit_code = 0, params = '' 1410s assert_output_contains = '' 1410s 1410s @pytest.mark.parametrize( 1410s "sql,exit_code,params,assert_output_contains", 1410s [ 1410s ( 1410s "create TABLE {{ params.dsfsdfds }}.t (a int)", 1410s 1, 1410s "-v", 1410s "Fix aborted due to unparsable template variables.", 1410s ), # template error 1410s ("create TABLE a.t (a int)", 0, "", ""), # fixable error 1410s ("create table a.t (a int)", 0, "", ""), # perfection 1410s ( 1410s "select col from a join b using (c)", 1410s 1, 1410s "-v", 1410s "Unfixable violations detected.", 1410s ), # unfixable error (using) 1410s ], 1410s ) 1410s def test__cli__command_fix_stdin_error_exit_code( 1410s sql, exit_code, params, assert_output_contains 1410s ): 1410s """Check that the CLI fails nicely if fixing a templated stdin.""" 1410s > invoke_assert_code( 1410s ret_code=exit_code, 1410s args=[fix, ((params,) if params else ()) + ("--dialect=ansi", "-")], 1410s cli_input=sql, 1410s assert_output_contains=assert_output_contains, 1410s ) 1410s 1410s test/cli/commands_test.py:1320: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 0, args = [, ('--dialect=ansi', '-')] 1410s kwargs = {'input': 'create TABLE a.t (a int)'} 1410s cli_input = 'create TABLE a.t (a int)', mix_stderr = True 1410s assert_output_contains = '', raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s __ test__cli__command_fix_stdin_error_exit_code[create table a.t (a int)-0--] __ 1410s 1410s sql = 'create table a.t (a int)', exit_code = 0, params = '' 1410s assert_output_contains = '' 1410s 1410s @pytest.mark.parametrize( 1410s "sql,exit_code,params,assert_output_contains", 1410s [ 1410s ( 1410s "create TABLE {{ params.dsfsdfds }}.t (a int)", 1410s 1, 1410s "-v", 1410s "Fix aborted due to unparsable template variables.", 1410s ), # template error 1410s ("create TABLE a.t (a int)", 0, "", ""), # fixable error 1410s ("create table a.t (a int)", 0, "", ""), # perfection 1410s ( 1410s "select col from a join b using (c)", 1410s 1, 1410s "-v", 1410s "Unfixable violations detected.", 1410s ), # unfixable error (using) 1410s ], 1410s ) 1410s def test__cli__command_fix_stdin_error_exit_code( 1410s sql, exit_code, params, assert_output_contains 1410s ): 1410s """Check that the CLI fails nicely if fixing a templated stdin.""" 1410s > invoke_assert_code( 1410s ret_code=exit_code, 1410s args=[fix, ((params,) if params else ()) + ("--dialect=ansi", "-")], 1410s cli_input=sql, 1410s assert_output_contains=assert_output_contains, 1410s ) 1410s 1410s test/cli/commands_test.py:1320: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 0, args = [, ('--dialect=ansi', '-')] 1410s kwargs = {'input': 'create table a.t (a int)'} 1410s cli_input = 'create table a.t (a int)', mix_stderr = True 1410s assert_output_contains = '', raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _ test__cli__command_fix_stdin_error_exit_code[select col from a join b using (c)-1--v-Unfixable violations detected.] _ 1410s 1410s sql = 'select col from a join b using (c)', exit_code = 1, params = '-v' 1410s assert_output_contains = 'Unfixable violations detected.' 1410s 1410s @pytest.mark.parametrize( 1410s "sql,exit_code,params,assert_output_contains", 1410s [ 1410s ( 1410s "create TABLE {{ params.dsfsdfds }}.t (a int)", 1410s 1, 1410s "-v", 1410s "Fix aborted due to unparsable template variables.", 1410s ), # template error 1410s ("create TABLE a.t (a int)", 0, "", ""), # fixable error 1410s ("create table a.t (a int)", 0, "", ""), # perfection 1410s ( 1410s "select col from a join b using (c)", 1410s 1, 1410s "-v", 1410s "Unfixable violations detected.", 1410s ), # unfixable error (using) 1410s ], 1410s ) 1410s def test__cli__command_fix_stdin_error_exit_code( 1410s sql, exit_code, params, assert_output_contains 1410s ): 1410s """Check that the CLI fails nicely if fixing a templated stdin.""" 1410s > invoke_assert_code( 1410s ret_code=exit_code, 1410s args=[fix, ((params,) if params else ()) + ("--dialect=ansi", "-")], 1410s cli_input=sql, 1410s assert_output_contains=assert_output_contains, 1410s ) 1410s 1410s test/cli/commands_test.py:1320: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1, args = [, ('-v', '--dialect=ansi', '-')] 1410s kwargs = {'input': 'select col from a join b using (c)'} 1410s cli_input = 'select col from a join b using (c)', mix_stderr = True 1410s assert_output_contains = 'Unfixable violations detected.' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _ test__cli__command__fix_check[LT01-test/fixtures/linter/indentation_errors.sql-y-0-0] _ 1410s 1410s rule = 'LT01', fname = 'test/fixtures/linter/indentation_errors.sql' 1410s prompt = 'y', exit_code = 0, fix_exit_code = 0 1410s 1410s @pytest.mark.parametrize( 1410s "rule,fname,prompt,exit_code,fix_exit_code", 1410s [ 1410s ("LT01", "test/fixtures/linter/indentation_errors.sql", "y", 0, 0), 1410s ("LT01", "test/fixtures/linter/indentation_errors.sql", "n", 1, 1), 1410s ], 1410s ) 1410s def test__cli__command__fix_check(rule, fname, prompt, exit_code, fix_exit_code): 1410s """Round trip test, using the prompts.""" 1410s with open(fname) as test_file: 1410s > generic_roundtrip_test( 1410s test_file, 1410s rule, 1410s check=True, 1410s final_exit_code=exit_code, 1410s fix_input=prompt, 1410s fix_exit_code=fix_exit_code, 1410s ) 1410s 1410s test/cli/commands_test.py:1338: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s test/cli/commands_test.py:928: in generic_roundtrip_test 1410s invoke_assert_code( 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ['--dialect=ansi', '--rules', 'LT01', '/tmp/tmp8zkdphv0/testing.sql']] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _ test__cli__command__fix_check[LT01-test/fixtures/linter/indentation_errors.sql-n-1-1] _ 1410s 1410s rule = 'LT01', fname = 'test/fixtures/linter/indentation_errors.sql' 1410s prompt = 'n', exit_code = 1, fix_exit_code = 1 1410s 1410s @pytest.mark.parametrize( 1410s "rule,fname,prompt,exit_code,fix_exit_code", 1410s [ 1410s ("LT01", "test/fixtures/linter/indentation_errors.sql", "y", 0, 0), 1410s ("LT01", "test/fixtures/linter/indentation_errors.sql", "n", 1, 1), 1410s ], 1410s ) 1410s def test__cli__command__fix_check(rule, fname, prompt, exit_code, fix_exit_code): 1410s """Round trip test, using the prompts.""" 1410s with open(fname) as test_file: 1410s > generic_roundtrip_test( 1410s test_file, 1410s rule, 1410s check=True, 1410s final_exit_code=exit_code, 1410s fix_input=prompt, 1410s fix_exit_code=fix_exit_code, 1410s ) 1410s 1410s test/cli/commands_test.py:1338: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s test/cli/commands_test.py:928: in generic_roundtrip_test 1410s invoke_assert_code( 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ['--dialect=ansi', '--rules', 'LT01', '/tmp/tmp9o7k4jvo/testing.sql']] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s ___________ test__cli__command_parse_serialize_from_stdin[None-yaml] ___________ 1410s 1410s serialize = 'yaml', write_file = None 1410s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_parse_seria0') 1410s 1410s @pytest.mark.parametrize("serialize", ["yaml", "json"]) 1410s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1410s def test__cli__command_parse_serialize_from_stdin(serialize, write_file, tmp_path): 1410s """Check that the parser serialized output option is working. 1410s 1410s This tests both output to stdout and output to file. 1410s 1410s Not going to test for the content of the output as that is subject to change. 1410s """ 1410s cmd_args = ("-", "--format", serialize, "--dialect=ansi") 1410s 1410s if write_file: 1410s target_file = os.path.join(tmp_path, write_file + "." + serialize) 1410s cmd_args += ("--write-output", target_file) 1410s 1410s > result = invoke_assert_code( 1410s args=[parse, cmd_args], 1410s cli_input="select * from tbl", 1410s ) 1410s 1410s test/cli/commands_test.py:1363: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 0 1410s args = [, ('-', '--format', 'yaml', '--dialect=ansi')] 1410s kwargs = {'input': 'select * from tbl'}, cli_input = 'select * from tbl' 1410s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s ___________ test__cli__command_parse_serialize_from_stdin[None-json] ___________ 1410s 1410s serialize = 'json', write_file = None 1410s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_parse_seria1') 1410s 1410s @pytest.mark.parametrize("serialize", ["yaml", "json"]) 1410s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1410s def test__cli__command_parse_serialize_from_stdin(serialize, write_file, tmp_path): 1410s """Check that the parser serialized output option is working. 1410s 1410s This tests both output to stdout and output to file. 1410s 1410s Not going to test for the content of the output as that is subject to change. 1410s """ 1410s cmd_args = ("-", "--format", serialize, "--dialect=ansi") 1410s 1410s if write_file: 1410s target_file = os.path.join(tmp_path, write_file + "." + serialize) 1410s cmd_args += ("--write-output", target_file) 1410s 1410s > result = invoke_assert_code( 1410s args=[parse, cmd_args], 1410s cli_input="select * from tbl", 1410s ) 1410s 1410s test/cli/commands_test.py:1363: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 0 1410s args = [, ('-', '--format', 'json', '--dialect=ansi')] 1410s kwargs = {'input': 'select * from tbl'}, cli_input = 'select * from tbl' 1410s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _________ test__cli__command_parse_serialize_from_stdin[outfile-yaml] __________ 1410s 1410s serialize = 'yaml', write_file = 'outfile' 1410s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_parse_seria2') 1410s 1410s @pytest.mark.parametrize("serialize", ["yaml", "json"]) 1410s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1410s def test__cli__command_parse_serialize_from_stdin(serialize, write_file, tmp_path): 1410s """Check that the parser serialized output option is working. 1410s 1410s This tests both output to stdout and output to file. 1410s 1410s Not going to test for the content of the output as that is subject to change. 1410s """ 1410s cmd_args = ("-", "--format", serialize, "--dialect=ansi") 1410s 1410s if write_file: 1410s target_file = os.path.join(tmp_path, write_file + "." + serialize) 1410s cmd_args += ("--write-output", target_file) 1410s 1410s > result = invoke_assert_code( 1410s args=[parse, cmd_args], 1410s cli_input="select * from tbl", 1410s ) 1410s 1410s test/cli/commands_test.py:1363: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 0 1410s args = [, ('-', '--format', 'yaml', '--dialect=ansi', '--write-output', '/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_parse_seria2/outfile.yaml')] 1410s kwargs = {'input': 'select * from tbl'}, cli_input = 'select * from tbl' 1410s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _________ test__cli__command_parse_serialize_from_stdin[outfile-json] __________ 1410s 1410s serialize = 'json', write_file = 'outfile' 1410s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_parse_seria3') 1410s 1410s @pytest.mark.parametrize("serialize", ["yaml", "json"]) 1410s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1410s def test__cli__command_parse_serialize_from_stdin(serialize, write_file, tmp_path): 1410s """Check that the parser serialized output option is working. 1410s 1410s This tests both output to stdout and output to file. 1410s 1410s Not going to test for the content of the output as that is subject to change. 1410s """ 1410s cmd_args = ("-", "--format", serialize, "--dialect=ansi") 1410s 1410s if write_file: 1410s target_file = os.path.join(tmp_path, write_file + "." + serialize) 1410s cmd_args += ("--write-output", target_file) 1410s 1410s > result = invoke_assert_code( 1410s args=[parse, cmd_args], 1410s cli_input="select * from tbl", 1410s ) 1410s 1410s test/cli/commands_test.py:1363: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 0 1410s args = [, ('-', '--format', 'json', '--dialect=ansi', '--write-output', '/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_parse_seria3/outfile.json')] 1410s kwargs = {'input': 'select * from tbl'}, cli_input = 'select * from tbl' 1410s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _ test__cli__command_lint_serialize_from_stdin[select * from tbl-CP01-expected0-0-yaml] _ 1410s 1410s serialize = 'yaml', sql = 'select * from tbl', rules = 'CP01' 1410s expected = [{'filepath': 'stdin', 'statistics': {'raw_segments': 12, 'segments': 24, 'source_chars': 17, 'templated_chars': 17}, 'violations': []}] 1410s exit_code = 0 1410s 1410s @pytest.mark.parametrize("serialize", ["yaml", "json", "none"]) 1410s @pytest.mark.parametrize( 1410s "sql,rules,expected,exit_code", 1410s [ 1410s ( 1410s "select * from tbl", 1410s "CP01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "statistics": { 1410s "raw_segments": 12, 1410s "segments": 24, 1410s "source_chars": 17, 1410s "templated_chars": 17, 1410s }, 1410s # Empty list because no violations. 1410s "violations": [], 1410s } 1410s ], 1410s 0, 1410s ), 1410s ( 1410s "SElect * from tbl", 1410s "CP01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "violations": [ 1410s { 1410s "code": "CP01", 1410s "start_line_no": 1, 1410s "start_line_pos": 1, 1410s "start_file_pos": 0, 1410s "end_line_no": 1, 1410s "end_line_pos": 7, 1410s "end_file_pos": 6, 1410s "description": "Keywords must be consistently upper case.", 1410s "name": "capitalisation.keywords", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "SELECT", 1410s "start_line_no": 1, 1410s "start_line_pos": 1, 1410s "start_file_pos": 0, 1410s "end_line_no": 1, 1410s "end_line_pos": 7, 1410s "end_file_pos": 6, 1410s } 1410s ], 1410s }, 1410s { 1410s "code": "CP01", 1410s "start_line_no": 1, 1410s "start_line_pos": 10, 1410s "start_file_pos": 9, 1410s "end_line_no": 1, 1410s "end_line_pos": 14, 1410s "end_file_pos": 13, 1410s "description": "Keywords must be consistently upper case.", 1410s "name": "capitalisation.keywords", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "FROM", 1410s "start_line_no": 1, 1410s "start_line_pos": 10, 1410s "start_file_pos": 9, 1410s "end_line_no": 1, 1410s "end_line_pos": 14, 1410s "end_file_pos": 13, 1410s } 1410s ], 1410s }, 1410s ], 1410s "statistics": { 1410s "raw_segments": 12, 1410s "segments": 24, 1410s "source_chars": 17, 1410s "templated_chars": 17, 1410s }, 1410s # NOTE: There will be a timings section too, but we're not 1410s # going to test that. 1410s } 1410s ], 1410s 1, 1410s ), 1410s # Test serialisation with a source only fix. 1410s ( 1410s "SELECT {{1}}", 1410s "JJ01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "violations": [ 1410s { 1410s "code": "JJ01", 1410s "start_line_no": 1, 1410s "start_line_pos": 8, 1410s "start_file_pos": 7, 1410s "end_line_no": 1, 1410s "end_line_pos": 13, 1410s "end_file_pos": 12, 1410s "description": ( 1410s "Jinja tags should have a single whitespace on " 1410s "either side: {{1}}" 1410s ), 1410s "name": "jinja.padding", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "{{ 1 }}", 1410s "start_line_no": 1, 1410s "start_line_pos": 8, 1410s "start_file_pos": 7, 1410s "end_line_no": 1, 1410s "end_line_pos": 13, 1410s "end_file_pos": 12, 1410s } 1410s ], 1410s }, 1410s ], 1410s "statistics": { 1410s "raw_segments": 6, 1410s "segments": 11, 1410s "source_chars": 12, 1410s "templated_chars": 8, 1410s }, 1410s # NOTE: There will be a timings section too, but we're not 1410s # going to test that. 1410s } 1410s ], 1410s 1, 1410s ), 1410s ], 1410s ) 1410s def test__cli__command_lint_serialize_from_stdin( 1410s serialize, sql, rules, expected, exit_code 1410s ): 1410s """Check an explicit serialized return value for a single error.""" 1410s > result = invoke_assert_code( 1410s args=[ 1410s lint, 1410s ( 1410s "-", 1410s "--rules", 1410s rules, 1410s "--format", 1410s serialize, 1410s "--disable-progress-bar", 1410s "--dialect=ansi", 1410s ), 1410s ], 1410s cli_input=sql, 1410s ret_code=exit_code, 1410s ) 1410s 1410s test/cli/commands_test.py:1528: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 0 1410s args = [, ('-', '--rules', 'CP01', '--format', 'yaml', '--disable-progress-bar', ...)] 1410s kwargs = {'input': 'select * from tbl'}, cli_input = 'select * from tbl' 1410s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _ test__cli__command_lint_serialize_from_stdin[select * from tbl-CP01-expected0-0-json] _ 1410s 1410s serialize = 'json', sql = 'select * from tbl', rules = 'CP01' 1410s expected = [{'filepath': 'stdin', 'statistics': {'raw_segments': 12, 'segments': 24, 'source_chars': 17, 'templated_chars': 17}, 'violations': []}] 1410s exit_code = 0 1410s 1410s @pytest.mark.parametrize("serialize", ["yaml", "json", "none"]) 1410s @pytest.mark.parametrize( 1410s "sql,rules,expected,exit_code", 1410s [ 1410s ( 1410s "select * from tbl", 1410s "CP01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "statistics": { 1410s "raw_segments": 12, 1410s "segments": 24, 1410s "source_chars": 17, 1410s "templated_chars": 17, 1410s }, 1410s # Empty list because no violations. 1410s "violations": [], 1410s } 1410s ], 1410s 0, 1410s ), 1410s ( 1410s "SElect * from tbl", 1410s "CP01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "violations": [ 1410s { 1410s "code": "CP01", 1410s "start_line_no": 1, 1410s "start_line_pos": 1, 1410s "start_file_pos": 0, 1410s "end_line_no": 1, 1410s "end_line_pos": 7, 1410s "end_file_pos": 6, 1410s "description": "Keywords must be consistently upper case.", 1410s "name": "capitalisation.keywords", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "SELECT", 1410s "start_line_no": 1, 1410s "start_line_pos": 1, 1410s "start_file_pos": 0, 1410s "end_line_no": 1, 1410s "end_line_pos": 7, 1410s "end_file_pos": 6, 1410s } 1410s ], 1410s }, 1410s { 1410s "code": "CP01", 1410s "start_line_no": 1, 1410s "start_line_pos": 10, 1410s "start_file_pos": 9, 1410s "end_line_no": 1, 1410s "end_line_pos": 14, 1410s "end_file_pos": 13, 1410s "description": "Keywords must be consistently upper case.", 1410s "name": "capitalisation.keywords", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "FROM", 1410s "start_line_no": 1, 1410s "start_line_pos": 10, 1410s "start_file_pos": 9, 1410s "end_line_no": 1, 1410s "end_line_pos": 14, 1410s "end_file_pos": 13, 1410s } 1410s ], 1410s }, 1410s ], 1410s "statistics": { 1410s "raw_segments": 12, 1410s "segments": 24, 1410s "source_chars": 17, 1410s "templated_chars": 17, 1410s }, 1410s # NOTE: There will be a timings section too, but we're not 1410s # going to test that. 1410s } 1410s ], 1410s 1, 1410s ), 1410s # Test serialisation with a source only fix. 1410s ( 1410s "SELECT {{1}}", 1410s "JJ01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "violations": [ 1410s { 1410s "code": "JJ01", 1410s "start_line_no": 1, 1410s "start_line_pos": 8, 1410s "start_file_pos": 7, 1410s "end_line_no": 1, 1410s "end_line_pos": 13, 1410s "end_file_pos": 12, 1410s "description": ( 1410s "Jinja tags should have a single whitespace on " 1410s "either side: {{1}}" 1410s ), 1410s "name": "jinja.padding", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "{{ 1 }}", 1410s "start_line_no": 1, 1410s "start_line_pos": 8, 1410s "start_file_pos": 7, 1410s "end_line_no": 1, 1410s "end_line_pos": 13, 1410s "end_file_pos": 12, 1410s } 1410s ], 1410s }, 1410s ], 1410s "statistics": { 1410s "raw_segments": 6, 1410s "segments": 11, 1410s "source_chars": 12, 1410s "templated_chars": 8, 1410s }, 1410s # NOTE: There will be a timings section too, but we're not 1410s # going to test that. 1410s } 1410s ], 1410s 1, 1410s ), 1410s ], 1410s ) 1410s def test__cli__command_lint_serialize_from_stdin( 1410s serialize, sql, rules, expected, exit_code 1410s ): 1410s """Check an explicit serialized return value for a single error.""" 1410s > result = invoke_assert_code( 1410s args=[ 1410s lint, 1410s ( 1410s "-", 1410s "--rules", 1410s rules, 1410s "--format", 1410s serialize, 1410s "--disable-progress-bar", 1410s "--dialect=ansi", 1410s ), 1410s ], 1410s cli_input=sql, 1410s ret_code=exit_code, 1410s ) 1410s 1410s test/cli/commands_test.py:1528: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 0 1410s args = [, ('-', '--rules', 'CP01', '--format', 'json', '--disable-progress-bar', ...)] 1410s kwargs = {'input': 'select * from tbl'}, cli_input = 'select * from tbl' 1410s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _ test__cli__command_lint_serialize_from_stdin[select * from tbl-CP01-expected0-0-none] _ 1410s 1410s serialize = 'none', sql = 'select * from tbl', rules = 'CP01' 1410s expected = [{'filepath': 'stdin', 'statistics': {'raw_segments': 12, 'segments': 24, 'source_chars': 17, 'templated_chars': 17}, 'violations': []}] 1410s exit_code = 0 1410s 1410s @pytest.mark.parametrize("serialize", ["yaml", "json", "none"]) 1410s @pytest.mark.parametrize( 1410s "sql,rules,expected,exit_code", 1410s [ 1410s ( 1410s "select * from tbl", 1410s "CP01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "statistics": { 1410s "raw_segments": 12, 1410s "segments": 24, 1410s "source_chars": 17, 1410s "templated_chars": 17, 1410s }, 1410s # Empty list because no violations. 1410s "violations": [], 1410s } 1410s ], 1410s 0, 1410s ), 1410s ( 1410s "SElect * from tbl", 1410s "CP01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "violations": [ 1410s { 1410s "code": "CP01", 1410s "start_line_no": 1, 1410s "start_line_pos": 1, 1410s "start_file_pos": 0, 1410s "end_line_no": 1, 1410s "end_line_pos": 7, 1410s "end_file_pos": 6, 1410s "description": "Keywords must be consistently upper case.", 1410s "name": "capitalisation.keywords", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "SELECT", 1410s "start_line_no": 1, 1410s "start_line_pos": 1, 1410s "start_file_pos": 0, 1410s "end_line_no": 1, 1410s "end_line_pos": 7, 1410s "end_file_pos": 6, 1410s } 1410s ], 1410s }, 1410s { 1410s "code": "CP01", 1410s "start_line_no": 1, 1410s "start_line_pos": 10, 1410s "start_file_pos": 9, 1410s "end_line_no": 1, 1410s "end_line_pos": 14, 1410s "end_file_pos": 13, 1410s "description": "Keywords must be consistently upper case.", 1410s "name": "capitalisation.keywords", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "FROM", 1410s "start_line_no": 1, 1410s "start_line_pos": 10, 1410s "start_file_pos": 9, 1410s "end_line_no": 1, 1410s "end_line_pos": 14, 1410s "end_file_pos": 13, 1410s } 1410s ], 1410s }, 1410s ], 1410s "statistics": { 1410s "raw_segments": 12, 1410s "segments": 24, 1410s "source_chars": 17, 1410s "templated_chars": 17, 1410s }, 1410s # NOTE: There will be a timings section too, but we're not 1410s # going to test that. 1410s } 1410s ], 1410s 1, 1410s ), 1410s # Test serialisation with a source only fix. 1410s ( 1410s "SELECT {{1}}", 1410s "JJ01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "violations": [ 1410s { 1410s "code": "JJ01", 1410s "start_line_no": 1, 1410s "start_line_pos": 8, 1410s "start_file_pos": 7, 1410s "end_line_no": 1, 1410s "end_line_pos": 13, 1410s "end_file_pos": 12, 1410s "description": ( 1410s "Jinja tags should have a single whitespace on " 1410s "either side: {{1}}" 1410s ), 1410s "name": "jinja.padding", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "{{ 1 }}", 1410s "start_line_no": 1, 1410s "start_line_pos": 8, 1410s "start_file_pos": 7, 1410s "end_line_no": 1, 1410s "end_line_pos": 13, 1410s "end_file_pos": 12, 1410s } 1410s ], 1410s }, 1410s ], 1410s "statistics": { 1410s "raw_segments": 6, 1410s "segments": 11, 1410s "source_chars": 12, 1410s "templated_chars": 8, 1410s }, 1410s # NOTE: There will be a timings section too, but we're not 1410s # going to test that. 1410s } 1410s ], 1410s 1, 1410s ), 1410s ], 1410s ) 1410s def test__cli__command_lint_serialize_from_stdin( 1410s serialize, sql, rules, expected, exit_code 1410s ): 1410s """Check an explicit serialized return value for a single error.""" 1410s > result = invoke_assert_code( 1410s args=[ 1410s lint, 1410s ( 1410s "-", 1410s "--rules", 1410s rules, 1410s "--format", 1410s serialize, 1410s "--disable-progress-bar", 1410s "--dialect=ansi", 1410s ), 1410s ], 1410s cli_input=sql, 1410s ret_code=exit_code, 1410s ) 1410s 1410s test/cli/commands_test.py:1528: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 0 1410s args = [, ('-', '--rules', 'CP01', '--format', 'none', '--disable-progress-bar', ...)] 1410s kwargs = {'input': 'select * from tbl'}, cli_input = 'select * from tbl' 1410s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _ test__cli__command_lint_serialize_from_stdin[SElect * from tbl-CP01-expected1-1-yaml] _ 1410s 1410s serialize = 'yaml', sql = 'SElect * from tbl', rules = 'CP01' 1410s expected = [{'filepath': 'stdin', 'statistics': {'raw_segments': 12, 'segments': 24, 'source_chars': 17, 'templated_chars': 17}, ...ode': 'CP01', 'description': 'Keywords must be consistently upper case.', 'end_file_pos': 13, 'end_line_no': 1, ...}]}] 1410s exit_code = 1 1410s 1410s @pytest.mark.parametrize("serialize", ["yaml", "json", "none"]) 1410s @pytest.mark.parametrize( 1410s "sql,rules,expected,exit_code", 1410s [ 1410s ( 1410s "select * from tbl", 1410s "CP01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "statistics": { 1410s "raw_segments": 12, 1410s "segments": 24, 1410s "source_chars": 17, 1410s "templated_chars": 17, 1410s }, 1410s # Empty list because no violations. 1410s "violations": [], 1410s } 1410s ], 1410s 0, 1410s ), 1410s ( 1410s "SElect * from tbl", 1410s "CP01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "violations": [ 1410s { 1410s "code": "CP01", 1410s "start_line_no": 1, 1410s "start_line_pos": 1, 1410s "start_file_pos": 0, 1410s "end_line_no": 1, 1410s "end_line_pos": 7, 1410s "end_file_pos": 6, 1410s "description": "Keywords must be consistently upper case.", 1410s "name": "capitalisation.keywords", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "SELECT", 1410s "start_line_no": 1, 1410s "start_line_pos": 1, 1410s "start_file_pos": 0, 1410s "end_line_no": 1, 1410s "end_line_pos": 7, 1410s "end_file_pos": 6, 1410s } 1410s ], 1410s }, 1410s { 1410s "code": "CP01", 1410s "start_line_no": 1, 1410s "start_line_pos": 10, 1410s "start_file_pos": 9, 1410s "end_line_no": 1, 1410s "end_line_pos": 14, 1410s "end_file_pos": 13, 1410s "description": "Keywords must be consistently upper case.", 1410s "name": "capitalisation.keywords", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "FROM", 1410s "start_line_no": 1, 1410s "start_line_pos": 10, 1410s "start_file_pos": 9, 1410s "end_line_no": 1, 1410s "end_line_pos": 14, 1410s "end_file_pos": 13, 1410s } 1410s ], 1410s }, 1410s ], 1410s "statistics": { 1410s "raw_segments": 12, 1410s "segments": 24, 1410s "source_chars": 17, 1410s "templated_chars": 17, 1410s }, 1410s # NOTE: There will be a timings section too, but we're not 1410s # going to test that. 1410s } 1410s ], 1410s 1, 1410s ), 1410s # Test serialisation with a source only fix. 1410s ( 1410s "SELECT {{1}}", 1410s "JJ01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "violations": [ 1410s { 1410s "code": "JJ01", 1410s "start_line_no": 1, 1410s "start_line_pos": 8, 1410s "start_file_pos": 7, 1410s "end_line_no": 1, 1410s "end_line_pos": 13, 1410s "end_file_pos": 12, 1410s "description": ( 1410s "Jinja tags should have a single whitespace on " 1410s "either side: {{1}}" 1410s ), 1410s "name": "jinja.padding", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "{{ 1 }}", 1410s "start_line_no": 1, 1410s "start_line_pos": 8, 1410s "start_file_pos": 7, 1410s "end_line_no": 1, 1410s "end_line_pos": 13, 1410s "end_file_pos": 12, 1410s } 1410s ], 1410s }, 1410s ], 1410s "statistics": { 1410s "raw_segments": 6, 1410s "segments": 11, 1410s "source_chars": 12, 1410s "templated_chars": 8, 1410s }, 1410s # NOTE: There will be a timings section too, but we're not 1410s # going to test that. 1410s } 1410s ], 1410s 1, 1410s ), 1410s ], 1410s ) 1410s def test__cli__command_lint_serialize_from_stdin( 1410s serialize, sql, rules, expected, exit_code 1410s ): 1410s """Check an explicit serialized return value for a single error.""" 1410s > result = invoke_assert_code( 1410s args=[ 1410s lint, 1410s ( 1410s "-", 1410s "--rules", 1410s rules, 1410s "--format", 1410s serialize, 1410s "--disable-progress-bar", 1410s "--dialect=ansi", 1410s ), 1410s ], 1410s cli_input=sql, 1410s ret_code=exit_code, 1410s ) 1410s 1410s test/cli/commands_test.py:1528: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ('-', '--rules', 'CP01', '--format', 'yaml', '--disable-progress-bar', ...)] 1410s kwargs = {'input': 'SElect * from tbl'}, cli_input = 'SElect * from tbl' 1410s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _ test__cli__command_lint_serialize_from_stdin[SElect * from tbl-CP01-expected1-1-json] _ 1410s 1410s serialize = 'json', sql = 'SElect * from tbl', rules = 'CP01' 1410s expected = [{'filepath': 'stdin', 'statistics': {'raw_segments': 12, 'segments': 24, 'source_chars': 17, 'templated_chars': 17}, ...ode': 'CP01', 'description': 'Keywords must be consistently upper case.', 'end_file_pos': 13, 'end_line_no': 1, ...}]}] 1410s exit_code = 1 1410s 1410s @pytest.mark.parametrize("serialize", ["yaml", "json", "none"]) 1410s @pytest.mark.parametrize( 1410s "sql,rules,expected,exit_code", 1410s [ 1410s ( 1410s "select * from tbl", 1410s "CP01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "statistics": { 1410s "raw_segments": 12, 1410s "segments": 24, 1410s "source_chars": 17, 1410s "templated_chars": 17, 1410s }, 1410s # Empty list because no violations. 1410s "violations": [], 1410s } 1410s ], 1410s 0, 1410s ), 1410s ( 1410s "SElect * from tbl", 1410s "CP01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "violations": [ 1410s { 1410s "code": "CP01", 1410s "start_line_no": 1, 1410s "start_line_pos": 1, 1410s "start_file_pos": 0, 1410s "end_line_no": 1, 1410s "end_line_pos": 7, 1410s "end_file_pos": 6, 1410s "description": "Keywords must be consistently upper case.", 1410s "name": "capitalisation.keywords", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "SELECT", 1410s "start_line_no": 1, 1410s "start_line_pos": 1, 1410s "start_file_pos": 0, 1410s "end_line_no": 1, 1410s "end_line_pos": 7, 1410s "end_file_pos": 6, 1410s } 1410s ], 1410s }, 1410s { 1410s "code": "CP01", 1410s "start_line_no": 1, 1410s "start_line_pos": 10, 1410s "start_file_pos": 9, 1410s "end_line_no": 1, 1410s "end_line_pos": 14, 1410s "end_file_pos": 13, 1410s "description": "Keywords must be consistently upper case.", 1410s "name": "capitalisation.keywords", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "FROM", 1410s "start_line_no": 1, 1410s "start_line_pos": 10, 1410s "start_file_pos": 9, 1410s "end_line_no": 1, 1410s "end_line_pos": 14, 1410s "end_file_pos": 13, 1410s } 1410s ], 1410s }, 1410s ], 1410s "statistics": { 1410s "raw_segments": 12, 1410s "segments": 24, 1410s "source_chars": 17, 1410s "templated_chars": 17, 1410s }, 1410s # NOTE: There will be a timings section too, but we're not 1410s # going to test that. 1410s } 1410s ], 1410s 1, 1410s ), 1410s # Test serialisation with a source only fix. 1410s ( 1410s "SELECT {{1}}", 1410s "JJ01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "violations": [ 1410s { 1410s "code": "JJ01", 1410s "start_line_no": 1, 1410s "start_line_pos": 8, 1410s "start_file_pos": 7, 1410s "end_line_no": 1, 1410s "end_line_pos": 13, 1410s "end_file_pos": 12, 1410s "description": ( 1410s "Jinja tags should have a single whitespace on " 1410s "either side: {{1}}" 1410s ), 1410s "name": "jinja.padding", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "{{ 1 }}", 1410s "start_line_no": 1, 1410s "start_line_pos": 8, 1410s "start_file_pos": 7, 1410s "end_line_no": 1, 1410s "end_line_pos": 13, 1410s "end_file_pos": 12, 1410s } 1410s ], 1410s }, 1410s ], 1410s "statistics": { 1410s "raw_segments": 6, 1410s "segments": 11, 1410s "source_chars": 12, 1410s "templated_chars": 8, 1410s }, 1410s # NOTE: There will be a timings section too, but we're not 1410s # going to test that. 1410s } 1410s ], 1410s 1, 1410s ), 1410s ], 1410s ) 1410s def test__cli__command_lint_serialize_from_stdin( 1410s serialize, sql, rules, expected, exit_code 1410s ): 1410s """Check an explicit serialized return value for a single error.""" 1410s > result = invoke_assert_code( 1410s args=[ 1410s lint, 1410s ( 1410s "-", 1410s "--rules", 1410s rules, 1410s "--format", 1410s serialize, 1410s "--disable-progress-bar", 1410s "--dialect=ansi", 1410s ), 1410s ], 1410s cli_input=sql, 1410s ret_code=exit_code, 1410s ) 1410s 1410s test/cli/commands_test.py:1528: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ('-', '--rules', 'CP01', '--format', 'json', '--disable-progress-bar', ...)] 1410s kwargs = {'input': 'SElect * from tbl'}, cli_input = 'SElect * from tbl' 1410s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _ test__cli__command_lint_serialize_from_stdin[SElect * from tbl-CP01-expected1-1-none] _ 1410s 1410s serialize = 'none', sql = 'SElect * from tbl', rules = 'CP01' 1410s expected = [{'filepath': 'stdin', 'statistics': {'raw_segments': 12, 'segments': 24, 'source_chars': 17, 'templated_chars': 17}, ...ode': 'CP01', 'description': 'Keywords must be consistently upper case.', 'end_file_pos': 13, 'end_line_no': 1, ...}]}] 1410s exit_code = 1 1410s 1410s @pytest.mark.parametrize("serialize", ["yaml", "json", "none"]) 1410s @pytest.mark.parametrize( 1410s "sql,rules,expected,exit_code", 1410s [ 1410s ( 1410s "select * from tbl", 1410s "CP01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "statistics": { 1410s "raw_segments": 12, 1410s "segments": 24, 1410s "source_chars": 17, 1410s "templated_chars": 17, 1410s }, 1410s # Empty list because no violations. 1410s "violations": [], 1410s } 1410s ], 1410s 0, 1410s ), 1410s ( 1410s "SElect * from tbl", 1410s "CP01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "violations": [ 1410s { 1410s "code": "CP01", 1410s "start_line_no": 1, 1410s "start_line_pos": 1, 1410s "start_file_pos": 0, 1410s "end_line_no": 1, 1410s "end_line_pos": 7, 1410s "end_file_pos": 6, 1410s "description": "Keywords must be consistently upper case.", 1410s "name": "capitalisation.keywords", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "SELECT", 1410s "start_line_no": 1, 1410s "start_line_pos": 1, 1410s "start_file_pos": 0, 1410s "end_line_no": 1, 1410s "end_line_pos": 7, 1410s "end_file_pos": 6, 1410s } 1410s ], 1410s }, 1410s { 1410s "code": "CP01", 1410s "start_line_no": 1, 1410s "start_line_pos": 10, 1410s "start_file_pos": 9, 1410s "end_line_no": 1, 1410s "end_line_pos": 14, 1410s "end_file_pos": 13, 1410s "description": "Keywords must be consistently upper case.", 1410s "name": "capitalisation.keywords", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "FROM", 1410s "start_line_no": 1, 1410s "start_line_pos": 10, 1410s "start_file_pos": 9, 1410s "end_line_no": 1, 1410s "end_line_pos": 14, 1410s "end_file_pos": 13, 1410s } 1410s ], 1410s }, 1410s ], 1410s "statistics": { 1410s "raw_segments": 12, 1410s "segments": 24, 1410s "source_chars": 17, 1410s "templated_chars": 17, 1410s }, 1410s # NOTE: There will be a timings section too, but we're not 1410s # going to test that. 1410s } 1410s ], 1410s 1, 1410s ), 1410s # Test serialisation with a source only fix. 1410s ( 1410s "SELECT {{1}}", 1410s "JJ01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "violations": [ 1410s { 1410s "code": "JJ01", 1410s "start_line_no": 1, 1410s "start_line_pos": 8, 1410s "start_file_pos": 7, 1410s "end_line_no": 1, 1410s "end_line_pos": 13, 1410s "end_file_pos": 12, 1410s "description": ( 1410s "Jinja tags should have a single whitespace on " 1410s "either side: {{1}}" 1410s ), 1410s "name": "jinja.padding", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "{{ 1 }}", 1410s "start_line_no": 1, 1410s "start_line_pos": 8, 1410s "start_file_pos": 7, 1410s "end_line_no": 1, 1410s "end_line_pos": 13, 1410s "end_file_pos": 12, 1410s } 1410s ], 1410s }, 1410s ], 1410s "statistics": { 1410s "raw_segments": 6, 1410s "segments": 11, 1410s "source_chars": 12, 1410s "templated_chars": 8, 1410s }, 1410s # NOTE: There will be a timings section too, but we're not 1410s # going to test that. 1410s } 1410s ], 1410s 1, 1410s ), 1410s ], 1410s ) 1410s def test__cli__command_lint_serialize_from_stdin( 1410s serialize, sql, rules, expected, exit_code 1410s ): 1410s """Check an explicit serialized return value for a single error.""" 1410s > result = invoke_assert_code( 1410s args=[ 1410s lint, 1410s ( 1410s "-", 1410s "--rules", 1410s rules, 1410s "--format", 1410s serialize, 1410s "--disable-progress-bar", 1410s "--dialect=ansi", 1410s ), 1410s ], 1410s cli_input=sql, 1410s ret_code=exit_code, 1410s ) 1410s 1410s test/cli/commands_test.py:1528: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ('-', '--rules', 'CP01', '--format', 'none', '--disable-progress-bar', ...)] 1410s kwargs = {'input': 'SElect * from tbl'}, cli_input = 'SElect * from tbl' 1410s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _ test__cli__command_lint_serialize_from_stdin[SELECT {{1}}-JJ01-expected2-1-yaml] _ 1410s 1410s serialize = 'yaml', sql = 'SELECT {{1}}', rules = 'JJ01' 1410s expected = [{'filepath': 'stdin', 'statistics': {'raw_segments': 6, 'segments': 11, 'source_chars': 12, 'templated_chars': 8}, 'v...ion': 'Jinja tags should have a single whitespace on either side: {{1}}', 'end_file_pos': 12, 'end_line_no': 1, ...}]}] 1410s exit_code = 1 1410s 1410s @pytest.mark.parametrize("serialize", ["yaml", "json", "none"]) 1410s @pytest.mark.parametrize( 1410s "sql,rules,expected,exit_code", 1410s [ 1410s ( 1410s "select * from tbl", 1410s "CP01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "statistics": { 1410s "raw_segments": 12, 1410s "segments": 24, 1410s "source_chars": 17, 1410s "templated_chars": 17, 1410s }, 1410s # Empty list because no violations. 1410s "violations": [], 1410s } 1410s ], 1410s 0, 1410s ), 1410s ( 1410s "SElect * from tbl", 1410s "CP01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "violations": [ 1410s { 1410s "code": "CP01", 1410s "start_line_no": 1, 1410s "start_line_pos": 1, 1410s "start_file_pos": 0, 1410s "end_line_no": 1, 1410s "end_line_pos": 7, 1410s "end_file_pos": 6, 1410s "description": "Keywords must be consistently upper case.", 1410s "name": "capitalisation.keywords", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "SELECT", 1410s "start_line_no": 1, 1410s "start_line_pos": 1, 1410s "start_file_pos": 0, 1410s "end_line_no": 1, 1410s "end_line_pos": 7, 1410s "end_file_pos": 6, 1410s } 1410s ], 1410s }, 1410s { 1410s "code": "CP01", 1410s "start_line_no": 1, 1410s "start_line_pos": 10, 1410s "start_file_pos": 9, 1410s "end_line_no": 1, 1410s "end_line_pos": 14, 1410s "end_file_pos": 13, 1410s "description": "Keywords must be consistently upper case.", 1410s "name": "capitalisation.keywords", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "FROM", 1410s "start_line_no": 1, 1410s "start_line_pos": 10, 1410s "start_file_pos": 9, 1410s "end_line_no": 1, 1410s "end_line_pos": 14, 1410s "end_file_pos": 13, 1410s } 1410s ], 1410s }, 1410s ], 1410s "statistics": { 1410s "raw_segments": 12, 1410s "segments": 24, 1410s "source_chars": 17, 1410s "templated_chars": 17, 1410s }, 1410s # NOTE: There will be a timings section too, but we're not 1410s # going to test that. 1410s } 1410s ], 1410s 1, 1410s ), 1410s # Test serialisation with a source only fix. 1410s ( 1410s "SELECT {{1}}", 1410s "JJ01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "violations": [ 1410s { 1410s "code": "JJ01", 1410s "start_line_no": 1, 1410s "start_line_pos": 8, 1410s "start_file_pos": 7, 1410s "end_line_no": 1, 1410s "end_line_pos": 13, 1410s "end_file_pos": 12, 1410s "description": ( 1410s "Jinja tags should have a single whitespace on " 1410s "either side: {{1}}" 1410s ), 1410s "name": "jinja.padding", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "{{ 1 }}", 1410s "start_line_no": 1, 1410s "start_line_pos": 8, 1410s "start_file_pos": 7, 1410s "end_line_no": 1, 1410s "end_line_pos": 13, 1410s "end_file_pos": 12, 1410s } 1410s ], 1410s }, 1410s ], 1410s "statistics": { 1410s "raw_segments": 6, 1410s "segments": 11, 1410s "source_chars": 12, 1410s "templated_chars": 8, 1410s }, 1410s # NOTE: There will be a timings section too, but we're not 1410s # going to test that. 1410s } 1410s ], 1410s 1, 1410s ), 1410s ], 1410s ) 1410s def test__cli__command_lint_serialize_from_stdin( 1410s serialize, sql, rules, expected, exit_code 1410s ): 1410s """Check an explicit serialized return value for a single error.""" 1410s > result = invoke_assert_code( 1410s args=[ 1410s lint, 1410s ( 1410s "-", 1410s "--rules", 1410s rules, 1410s "--format", 1410s serialize, 1410s "--disable-progress-bar", 1410s "--dialect=ansi", 1410s ), 1410s ], 1410s cli_input=sql, 1410s ret_code=exit_code, 1410s ) 1410s 1410s test/cli/commands_test.py:1528: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ('-', '--rules', 'JJ01', '--format', 'yaml', '--disable-progress-bar', ...)] 1410s kwargs = {'input': 'SELECT {{1}}'}, cli_input = 'SELECT {{1}}' 1410s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _ test__cli__command_lint_serialize_from_stdin[SELECT {{1}}-JJ01-expected2-1-json] _ 1410s 1410s serialize = 'json', sql = 'SELECT {{1}}', rules = 'JJ01' 1410s expected = [{'filepath': 'stdin', 'statistics': {'raw_segments': 6, 'segments': 11, 'source_chars': 12, 'templated_chars': 8}, 'v...ion': 'Jinja tags should have a single whitespace on either side: {{1}}', 'end_file_pos': 12, 'end_line_no': 1, ...}]}] 1410s exit_code = 1 1410s 1410s @pytest.mark.parametrize("serialize", ["yaml", "json", "none"]) 1410s @pytest.mark.parametrize( 1410s "sql,rules,expected,exit_code", 1410s [ 1410s ( 1410s "select * from tbl", 1410s "CP01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "statistics": { 1410s "raw_segments": 12, 1410s "segments": 24, 1410s "source_chars": 17, 1410s "templated_chars": 17, 1410s }, 1410s # Empty list because no violations. 1410s "violations": [], 1410s } 1410s ], 1410s 0, 1410s ), 1410s ( 1410s "SElect * from tbl", 1410s "CP01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "violations": [ 1410s { 1410s "code": "CP01", 1410s "start_line_no": 1, 1410s "start_line_pos": 1, 1410s "start_file_pos": 0, 1410s "end_line_no": 1, 1410s "end_line_pos": 7, 1410s "end_file_pos": 6, 1410s "description": "Keywords must be consistently upper case.", 1410s "name": "capitalisation.keywords", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "SELECT", 1410s "start_line_no": 1, 1410s "start_line_pos": 1, 1410s "start_file_pos": 0, 1410s "end_line_no": 1, 1410s "end_line_pos": 7, 1410s "end_file_pos": 6, 1410s } 1410s ], 1410s }, 1410s { 1410s "code": "CP01", 1410s "start_line_no": 1, 1410s "start_line_pos": 10, 1410s "start_file_pos": 9, 1410s "end_line_no": 1, 1410s "end_line_pos": 14, 1410s "end_file_pos": 13, 1410s "description": "Keywords must be consistently upper case.", 1410s "name": "capitalisation.keywords", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "FROM", 1410s "start_line_no": 1, 1410s "start_line_pos": 10, 1410s "start_file_pos": 9, 1410s "end_line_no": 1, 1410s "end_line_pos": 14, 1410s "end_file_pos": 13, 1410s } 1410s ], 1410s }, 1410s ], 1410s "statistics": { 1410s "raw_segments": 12, 1410s "segments": 24, 1410s "source_chars": 17, 1410s "templated_chars": 17, 1410s }, 1410s # NOTE: There will be a timings section too, but we're not 1410s # going to test that. 1410s } 1410s ], 1410s 1, 1410s ), 1410s # Test serialisation with a source only fix. 1410s ( 1410s "SELECT {{1}}", 1410s "JJ01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "violations": [ 1410s { 1410s "code": "JJ01", 1410s "start_line_no": 1, 1410s "start_line_pos": 8, 1410s "start_file_pos": 7, 1410s "end_line_no": 1, 1410s "end_line_pos": 13, 1410s "end_file_pos": 12, 1410s "description": ( 1410s "Jinja tags should have a single whitespace on " 1410s "either side: {{1}}" 1410s ), 1410s "name": "jinja.padding", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "{{ 1 }}", 1410s "start_line_no": 1, 1410s "start_line_pos": 8, 1410s "start_file_pos": 7, 1410s "end_line_no": 1, 1410s "end_line_pos": 13, 1410s "end_file_pos": 12, 1410s } 1410s ], 1410s }, 1410s ], 1410s "statistics": { 1410s "raw_segments": 6, 1410s "segments": 11, 1410s "source_chars": 12, 1410s "templated_chars": 8, 1410s }, 1410s # NOTE: There will be a timings section too, but we're not 1410s # going to test that. 1410s } 1410s ], 1410s 1, 1410s ), 1410s ], 1410s ) 1410s def test__cli__command_lint_serialize_from_stdin( 1410s serialize, sql, rules, expected, exit_code 1410s ): 1410s """Check an explicit serialized return value for a single error.""" 1410s > result = invoke_assert_code( 1410s args=[ 1410s lint, 1410s ( 1410s "-", 1410s "--rules", 1410s rules, 1410s "--format", 1410s serialize, 1410s "--disable-progress-bar", 1410s "--dialect=ansi", 1410s ), 1410s ], 1410s cli_input=sql, 1410s ret_code=exit_code, 1410s ) 1410s 1410s test/cli/commands_test.py:1528: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ('-', '--rules', 'JJ01', '--format', 'json', '--disable-progress-bar', ...)] 1410s kwargs = {'input': 'SELECT {{1}}'}, cli_input = 'SELECT {{1}}' 1410s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _ test__cli__command_lint_serialize_from_stdin[SELECT {{1}}-JJ01-expected2-1-none] _ 1410s 1410s serialize = 'none', sql = 'SELECT {{1}}', rules = 'JJ01' 1410s expected = [{'filepath': 'stdin', 'statistics': {'raw_segments': 6, 'segments': 11, 'source_chars': 12, 'templated_chars': 8}, 'v...ion': 'Jinja tags should have a single whitespace on either side: {{1}}', 'end_file_pos': 12, 'end_line_no': 1, ...}]}] 1410s exit_code = 1 1410s 1410s @pytest.mark.parametrize("serialize", ["yaml", "json", "none"]) 1410s @pytest.mark.parametrize( 1410s "sql,rules,expected,exit_code", 1410s [ 1410s ( 1410s "select * from tbl", 1410s "CP01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "statistics": { 1410s "raw_segments": 12, 1410s "segments": 24, 1410s "source_chars": 17, 1410s "templated_chars": 17, 1410s }, 1410s # Empty list because no violations. 1410s "violations": [], 1410s } 1410s ], 1410s 0, 1410s ), 1410s ( 1410s "SElect * from tbl", 1410s "CP01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "violations": [ 1410s { 1410s "code": "CP01", 1410s "start_line_no": 1, 1410s "start_line_pos": 1, 1410s "start_file_pos": 0, 1410s "end_line_no": 1, 1410s "end_line_pos": 7, 1410s "end_file_pos": 6, 1410s "description": "Keywords must be consistently upper case.", 1410s "name": "capitalisation.keywords", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "SELECT", 1410s "start_line_no": 1, 1410s "start_line_pos": 1, 1410s "start_file_pos": 0, 1410s "end_line_no": 1, 1410s "end_line_pos": 7, 1410s "end_file_pos": 6, 1410s } 1410s ], 1410s }, 1410s { 1410s "code": "CP01", 1410s "start_line_no": 1, 1410s "start_line_pos": 10, 1410s "start_file_pos": 9, 1410s "end_line_no": 1, 1410s "end_line_pos": 14, 1410s "end_file_pos": 13, 1410s "description": "Keywords must be consistently upper case.", 1410s "name": "capitalisation.keywords", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "FROM", 1410s "start_line_no": 1, 1410s "start_line_pos": 10, 1410s "start_file_pos": 9, 1410s "end_line_no": 1, 1410s "end_line_pos": 14, 1410s "end_file_pos": 13, 1410s } 1410s ], 1410s }, 1410s ], 1410s "statistics": { 1410s "raw_segments": 12, 1410s "segments": 24, 1410s "source_chars": 17, 1410s "templated_chars": 17, 1410s }, 1410s # NOTE: There will be a timings section too, but we're not 1410s # going to test that. 1410s } 1410s ], 1410s 1, 1410s ), 1410s # Test serialisation with a source only fix. 1410s ( 1410s "SELECT {{1}}", 1410s "JJ01", 1410s [ 1410s { 1410s "filepath": "stdin", 1410s "violations": [ 1410s { 1410s "code": "JJ01", 1410s "start_line_no": 1, 1410s "start_line_pos": 8, 1410s "start_file_pos": 7, 1410s "end_line_no": 1, 1410s "end_line_pos": 13, 1410s "end_file_pos": 12, 1410s "description": ( 1410s "Jinja tags should have a single whitespace on " 1410s "either side: {{1}}" 1410s ), 1410s "name": "jinja.padding", 1410s "warning": False, 1410s "fixes": [ 1410s { 1410s "type": "replace", 1410s "edit": "{{ 1 }}", 1410s "start_line_no": 1, 1410s "start_line_pos": 8, 1410s "start_file_pos": 7, 1410s "end_line_no": 1, 1410s "end_line_pos": 13, 1410s "end_file_pos": 12, 1410s } 1410s ], 1410s }, 1410s ], 1410s "statistics": { 1410s "raw_segments": 6, 1410s "segments": 11, 1410s "source_chars": 12, 1410s "templated_chars": 8, 1410s }, 1410s # NOTE: There will be a timings section too, but we're not 1410s # going to test that. 1410s } 1410s ], 1410s 1, 1410s ), 1410s ], 1410s ) 1410s def test__cli__command_lint_serialize_from_stdin( 1410s serialize, sql, rules, expected, exit_code 1410s ): 1410s """Check an explicit serialized return value for a single error.""" 1410s > result = invoke_assert_code( 1410s args=[ 1410s lint, 1410s ( 1410s "-", 1410s "--rules", 1410s rules, 1410s "--format", 1410s serialize, 1410s "--disable-progress-bar", 1410s "--dialect=ansi", 1410s ), 1410s ], 1410s cli_input=sql, 1410s ret_code=exit_code, 1410s ) 1410s 1410s test/cli/commands_test.py:1528: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ('-', '--rules', 'JJ01', '--format', 'none', '--disable-progress-bar', ...)] 1410s kwargs = {'input': 'SELECT {{1}}'}, cli_input = 'SELECT {{1}}' 1410s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _______________ test__cli__command_fail_nice_not_found[command0] _______________ 1410s 1410s command = [, 'this_file_does_not_exist.sql'] 1410s 1410s @pytest.mark.parametrize( 1410s "command", 1410s [ 1410s [lint, ("this_file_does_not_exist.sql")], 1410s [fix, ("this_file_does_not_exist.sql")], 1410s ], 1410s ) 1410s def test__cli__command_fail_nice_not_found(command): 1410s """Check commands fail as expected when then don't find files.""" 1410s > invoke_assert_code( 1410s args=command, 1410s ret_code=2, 1410s assert_output_contains=( 1410s "User Error: Specified path does not exist. Check it/they " 1410s "exist(s): this_file_does_not_exist.sql" 1410s ), 1410s ) 1410s 1410s test/cli/commands_test.py:1574: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 2, args = [, 'this_file_does_not_exist.sql'] 1410s kwargs = {}, cli_input = None, mix_stderr = True 1410s assert_output_contains = 'User Error: Specified path does not exist. Check it/they exist(s): this_file_does_not_exist.sql' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _______________ test__cli__command_fail_nice_not_found[command1] _______________ 1410s 1410s command = [, 'this_file_does_not_exist.sql'] 1410s 1410s @pytest.mark.parametrize( 1410s "command", 1410s [ 1410s [lint, ("this_file_does_not_exist.sql")], 1410s [fix, ("this_file_does_not_exist.sql")], 1410s ], 1410s ) 1410s def test__cli__command_fail_nice_not_found(command): 1410s """Check commands fail as expected when then don't find files.""" 1410s > invoke_assert_code( 1410s args=command, 1410s ret_code=2, 1410s assert_output_contains=( 1410s "User Error: Specified path does not exist. Check it/they " 1410s "exist(s): this_file_does_not_exist.sql" 1410s ), 1410s ) 1410s 1410s test/cli/commands_test.py:1574: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 2, args = [, 'this_file_does_not_exist.sql'] 1410s kwargs = {}, cli_input = None, mix_stderr = True 1410s assert_output_contains = 'User Error: Specified path does not exist. Check it/they exist(s): this_file_does_not_exist.sql' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _________ test__cli__command_lint_serialize_multiple_files[None-human] _________ 1410s 1410s serialize = 'human', write_file = None 1410s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_lint_serial0') 1410s 1410s @pytest.mark.parametrize( 1410s "serialize", 1410s ["human", "yaml", "json", "github-annotation", "github-annotation-native", "none"], 1410s ) 1410s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1410s def test__cli__command_lint_serialize_multiple_files(serialize, write_file, tmp_path): 1410s """Test the output formats for multiple files. 1410s 1410s This tests runs both stdout checking and file checking. 1410s """ 1410s fpath1 = "test/fixtures/linter/indentation_errors.sql" 1410s fpath2 = "test/fixtures/linter/multiple_sql_errors.sql" 1410s 1410s cmd_args = ( 1410s fpath1, 1410s fpath2, 1410s "--format", 1410s serialize, 1410s "--disable-progress-bar", 1410s ) 1410s 1410s if write_file: 1410s ext = { 1410s "human": ".txt", 1410s "yaml": ".yaml", 1410s } 1410s target_file = os.path.join(tmp_path, write_file + ext.get(serialize, ".json")) 1410s cmd_args += ("--write-output", target_file) 1410s 1410s # note the file is in here twice. two files = two payloads. 1410s > result = invoke_assert_code( 1410s args=[lint, cmd_args], 1410s ret_code=1, 1410s ) 1410s 1410s test/cli/commands_test.py:1644: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ('test/fixtures/linter/indentation_errors.sql', 'test/fixtures/linter/multiple_sql_errors.sql', '--format', 'human', '--disable-progress-bar')] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _________ test__cli__command_lint_serialize_multiple_files[None-yaml] __________ 1410s 1410s serialize = 'yaml', write_file = None 1410s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_lint_serial1') 1410s 1410s @pytest.mark.parametrize( 1410s "serialize", 1410s ["human", "yaml", "json", "github-annotation", "github-annotation-native", "none"], 1410s ) 1410s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1410s def test__cli__command_lint_serialize_multiple_files(serialize, write_file, tmp_path): 1410s """Test the output formats for multiple files. 1410s 1410s This tests runs both stdout checking and file checking. 1410s """ 1410s fpath1 = "test/fixtures/linter/indentation_errors.sql" 1410s fpath2 = "test/fixtures/linter/multiple_sql_errors.sql" 1410s 1410s cmd_args = ( 1410s fpath1, 1410s fpath2, 1410s "--format", 1410s serialize, 1410s "--disable-progress-bar", 1410s ) 1410s 1410s if write_file: 1410s ext = { 1410s "human": ".txt", 1410s "yaml": ".yaml", 1410s } 1410s target_file = os.path.join(tmp_path, write_file + ext.get(serialize, ".json")) 1410s cmd_args += ("--write-output", target_file) 1410s 1410s # note the file is in here twice. two files = two payloads. 1410s > result = invoke_assert_code( 1410s args=[lint, cmd_args], 1410s ret_code=1, 1410s ) 1410s 1410s test/cli/commands_test.py:1644: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ('test/fixtures/linter/indentation_errors.sql', 'test/fixtures/linter/multiple_sql_errors.sql', '--format', 'yaml', '--disable-progress-bar')] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _________ test__cli__command_lint_serialize_multiple_files[None-json] __________ 1410s 1410s serialize = 'json', write_file = None 1410s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_lint_serial2') 1410s 1410s @pytest.mark.parametrize( 1410s "serialize", 1410s ["human", "yaml", "json", "github-annotation", "github-annotation-native", "none"], 1410s ) 1410s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1410s def test__cli__command_lint_serialize_multiple_files(serialize, write_file, tmp_path): 1410s """Test the output formats for multiple files. 1410s 1410s This tests runs both stdout checking and file checking. 1410s """ 1410s fpath1 = "test/fixtures/linter/indentation_errors.sql" 1410s fpath2 = "test/fixtures/linter/multiple_sql_errors.sql" 1410s 1410s cmd_args = ( 1410s fpath1, 1410s fpath2, 1410s "--format", 1410s serialize, 1410s "--disable-progress-bar", 1410s ) 1410s 1410s if write_file: 1410s ext = { 1410s "human": ".txt", 1410s "yaml": ".yaml", 1410s } 1410s target_file = os.path.join(tmp_path, write_file + ext.get(serialize, ".json")) 1410s cmd_args += ("--write-output", target_file) 1410s 1410s # note the file is in here twice. two files = two payloads. 1410s > result = invoke_assert_code( 1410s args=[lint, cmd_args], 1410s ret_code=1, 1410s ) 1410s 1410s test/cli/commands_test.py:1644: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ('test/fixtures/linter/indentation_errors.sql', 'test/fixtures/linter/multiple_sql_errors.sql', '--format', 'json', '--disable-progress-bar')] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s ___ test__cli__command_lint_serialize_multiple_files[None-github-annotation] ___ 1410s 1410s serialize = 'github-annotation', write_file = None 1410s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_lint_serial3') 1410s 1410s @pytest.mark.parametrize( 1410s "serialize", 1410s ["human", "yaml", "json", "github-annotation", "github-annotation-native", "none"], 1410s ) 1410s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1410s def test__cli__command_lint_serialize_multiple_files(serialize, write_file, tmp_path): 1410s """Test the output formats for multiple files. 1410s 1410s This tests runs both stdout checking and file checking. 1410s """ 1410s fpath1 = "test/fixtures/linter/indentation_errors.sql" 1410s fpath2 = "test/fixtures/linter/multiple_sql_errors.sql" 1410s 1410s cmd_args = ( 1410s fpath1, 1410s fpath2, 1410s "--format", 1410s serialize, 1410s "--disable-progress-bar", 1410s ) 1410s 1410s if write_file: 1410s ext = { 1410s "human": ".txt", 1410s "yaml": ".yaml", 1410s } 1410s target_file = os.path.join(tmp_path, write_file + ext.get(serialize, ".json")) 1410s cmd_args += ("--write-output", target_file) 1410s 1410s # note the file is in here twice. two files = two payloads. 1410s > result = invoke_assert_code( 1410s args=[lint, cmd_args], 1410s ret_code=1, 1410s ) 1410s 1410s test/cli/commands_test.py:1644: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ('test/fixtures/linter/indentation_errors.sql', 'test/fixtures/linter/multiple_sql_errors.sql', '--format', 'github-annotation', '--disable-progress-bar')] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _ test__cli__command_lint_serialize_multiple_files[None-github-annotation-native] _ 1410s 1410s serialize = 'github-annotation-native', write_file = None 1410s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_lint_serial4') 1410s 1410s @pytest.mark.parametrize( 1410s "serialize", 1410s ["human", "yaml", "json", "github-annotation", "github-annotation-native", "none"], 1410s ) 1410s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1410s def test__cli__command_lint_serialize_multiple_files(serialize, write_file, tmp_path): 1410s """Test the output formats for multiple files. 1410s 1410s This tests runs both stdout checking and file checking. 1410s """ 1410s fpath1 = "test/fixtures/linter/indentation_errors.sql" 1410s fpath2 = "test/fixtures/linter/multiple_sql_errors.sql" 1410s 1410s cmd_args = ( 1410s fpath1, 1410s fpath2, 1410s "--format", 1410s serialize, 1410s "--disable-progress-bar", 1410s ) 1410s 1410s if write_file: 1410s ext = { 1410s "human": ".txt", 1410s "yaml": ".yaml", 1410s } 1410s target_file = os.path.join(tmp_path, write_file + ext.get(serialize, ".json")) 1410s cmd_args += ("--write-output", target_file) 1410s 1410s # note the file is in here twice. two files = two payloads. 1410s > result = invoke_assert_code( 1410s args=[lint, cmd_args], 1410s ret_code=1, 1410s ) 1410s 1410s test/cli/commands_test.py:1644: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ('test/fixtures/linter/indentation_errors.sql', 'test/fixtures/linter/multiple_sql_errors.sql', '--format', 'github-annotation-native', '--disable-progress-bar')] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _________ test__cli__command_lint_serialize_multiple_files[None-none] __________ 1410s 1410s serialize = 'none', write_file = None 1410s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_lint_serial5') 1410s 1410s @pytest.mark.parametrize( 1410s "serialize", 1410s ["human", "yaml", "json", "github-annotation", "github-annotation-native", "none"], 1410s ) 1410s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1410s def test__cli__command_lint_serialize_multiple_files(serialize, write_file, tmp_path): 1410s """Test the output formats for multiple files. 1410s 1410s This tests runs both stdout checking and file checking. 1410s """ 1410s fpath1 = "test/fixtures/linter/indentation_errors.sql" 1410s fpath2 = "test/fixtures/linter/multiple_sql_errors.sql" 1410s 1410s cmd_args = ( 1410s fpath1, 1410s fpath2, 1410s "--format", 1410s serialize, 1410s "--disable-progress-bar", 1410s ) 1410s 1410s if write_file: 1410s ext = { 1410s "human": ".txt", 1410s "yaml": ".yaml", 1410s } 1410s target_file = os.path.join(tmp_path, write_file + ext.get(serialize, ".json")) 1410s cmd_args += ("--write-output", target_file) 1410s 1410s # note the file is in here twice. two files = two payloads. 1410s > result = invoke_assert_code( 1410s args=[lint, cmd_args], 1410s ret_code=1, 1410s ) 1410s 1410s test/cli/commands_test.py:1644: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ('test/fixtures/linter/indentation_errors.sql', 'test/fixtures/linter/multiple_sql_errors.sql', '--format', 'none', '--disable-progress-bar')] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _______ test__cli__command_lint_serialize_multiple_files[outfile-human] ________ 1410s 1410s serialize = 'human', write_file = 'outfile' 1410s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_lint_serial6') 1410s 1410s @pytest.mark.parametrize( 1410s "serialize", 1410s ["human", "yaml", "json", "github-annotation", "github-annotation-native", "none"], 1410s ) 1410s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1410s def test__cli__command_lint_serialize_multiple_files(serialize, write_file, tmp_path): 1410s """Test the output formats for multiple files. 1410s 1410s This tests runs both stdout checking and file checking. 1410s """ 1410s fpath1 = "test/fixtures/linter/indentation_errors.sql" 1410s fpath2 = "test/fixtures/linter/multiple_sql_errors.sql" 1410s 1410s cmd_args = ( 1410s fpath1, 1410s fpath2, 1410s "--format", 1410s serialize, 1410s "--disable-progress-bar", 1410s ) 1410s 1410s if write_file: 1410s ext = { 1410s "human": ".txt", 1410s "yaml": ".yaml", 1410s } 1410s target_file = os.path.join(tmp_path, write_file + ext.get(serialize, ".json")) 1410s cmd_args += ("--write-output", target_file) 1410s 1410s # note the file is in here twice. two files = two payloads. 1410s > result = invoke_assert_code( 1410s args=[lint, cmd_args], 1410s ret_code=1, 1410s ) 1410s 1410s test/cli/commands_test.py:1644: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ('test/fixtures/linter/indentation_errors.sql', 'test/fixtures/linter/multiple_sql_errors.sql', '--format', 'human', '--disable-progress-bar', '--write-output', ...)] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s ________ test__cli__command_lint_serialize_multiple_files[outfile-yaml] ________ 1410s 1410s serialize = 'yaml', write_file = 'outfile' 1410s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_lint_serial7') 1410s 1410s @pytest.mark.parametrize( 1410s "serialize", 1410s ["human", "yaml", "json", "github-annotation", "github-annotation-native", "none"], 1410s ) 1410s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1410s def test__cli__command_lint_serialize_multiple_files(serialize, write_file, tmp_path): 1410s """Test the output formats for multiple files. 1410s 1410s This tests runs both stdout checking and file checking. 1410s """ 1410s fpath1 = "test/fixtures/linter/indentation_errors.sql" 1410s fpath2 = "test/fixtures/linter/multiple_sql_errors.sql" 1410s 1410s cmd_args = ( 1410s fpath1, 1410s fpath2, 1410s "--format", 1410s serialize, 1410s "--disable-progress-bar", 1410s ) 1410s 1410s if write_file: 1410s ext = { 1410s "human": ".txt", 1410s "yaml": ".yaml", 1410s } 1410s target_file = os.path.join(tmp_path, write_file + ext.get(serialize, ".json")) 1410s cmd_args += ("--write-output", target_file) 1410s 1410s # note the file is in here twice. two files = two payloads. 1410s > result = invoke_assert_code( 1410s args=[lint, cmd_args], 1410s ret_code=1, 1410s ) 1410s 1410s test/cli/commands_test.py:1644: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ('test/fixtures/linter/indentation_errors.sql', 'test/fixtures/linter/multiple_sql_errors.sql', '--format', 'yaml', '--disable-progress-bar', '--write-output', ...)] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s ________ test__cli__command_lint_serialize_multiple_files[outfile-json] ________ 1410s 1410s serialize = 'json', write_file = 'outfile' 1410s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_lint_serial8') 1410s 1410s @pytest.mark.parametrize( 1410s "serialize", 1410s ["human", "yaml", "json", "github-annotation", "github-annotation-native", "none"], 1410s ) 1410s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1410s def test__cli__command_lint_serialize_multiple_files(serialize, write_file, tmp_path): 1410s """Test the output formats for multiple files. 1410s 1410s This tests runs both stdout checking and file checking. 1410s """ 1410s fpath1 = "test/fixtures/linter/indentation_errors.sql" 1410s fpath2 = "test/fixtures/linter/multiple_sql_errors.sql" 1410s 1410s cmd_args = ( 1410s fpath1, 1410s fpath2, 1410s "--format", 1410s serialize, 1410s "--disable-progress-bar", 1410s ) 1410s 1410s if write_file: 1410s ext = { 1410s "human": ".txt", 1410s "yaml": ".yaml", 1410s } 1410s target_file = os.path.join(tmp_path, write_file + ext.get(serialize, ".json")) 1410s cmd_args += ("--write-output", target_file) 1410s 1410s # note the file is in here twice. two files = two payloads. 1410s > result = invoke_assert_code( 1410s args=[lint, cmd_args], 1410s ret_code=1, 1410s ) 1410s 1410s test/cli/commands_test.py:1644: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ('test/fixtures/linter/indentation_errors.sql', 'test/fixtures/linter/multiple_sql_errors.sql', '--format', 'json', '--disable-progress-bar', '--write-output', ...)] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _ test__cli__command_lint_serialize_multiple_files[outfile-github-annotation] __ 1410s 1410s serialize = 'github-annotation', write_file = 'outfile' 1410s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_lint_serial9') 1410s 1410s @pytest.mark.parametrize( 1410s "serialize", 1410s ["human", "yaml", "json", "github-annotation", "github-annotation-native", "none"], 1410s ) 1410s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1410s def test__cli__command_lint_serialize_multiple_files(serialize, write_file, tmp_path): 1410s """Test the output formats for multiple files. 1410s 1410s This tests runs both stdout checking and file checking. 1410s """ 1410s fpath1 = "test/fixtures/linter/indentation_errors.sql" 1410s fpath2 = "test/fixtures/linter/multiple_sql_errors.sql" 1410s 1410s cmd_args = ( 1410s fpath1, 1410s fpath2, 1410s "--format", 1410s serialize, 1410s "--disable-progress-bar", 1410s ) 1410s 1410s if write_file: 1410s ext = { 1410s "human": ".txt", 1410s "yaml": ".yaml", 1410s } 1410s target_file = os.path.join(tmp_path, write_file + ext.get(serialize, ".json")) 1410s cmd_args += ("--write-output", target_file) 1410s 1410s # note the file is in here twice. two files = two payloads. 1410s > result = invoke_assert_code( 1410s args=[lint, cmd_args], 1410s ret_code=1, 1410s ) 1410s 1410s test/cli/commands_test.py:1644: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ('test/fixtures/linter/indentation_errors.sql', 'test/fixtures/linter/multiple_sql_errors.sql', '--format', 'github-annotation', '--disable-progress-bar', '--write-output', ...)] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _ test__cli__command_lint_serialize_multiple_files[outfile-github-annotation-native] _ 1410s 1410s serialize = 'github-annotation-native', write_file = 'outfile' 1410s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_lint_serial10') 1410s 1410s @pytest.mark.parametrize( 1410s "serialize", 1410s ["human", "yaml", "json", "github-annotation", "github-annotation-native", "none"], 1410s ) 1410s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1410s def test__cli__command_lint_serialize_multiple_files(serialize, write_file, tmp_path): 1410s """Test the output formats for multiple files. 1410s 1410s This tests runs both stdout checking and file checking. 1410s """ 1410s fpath1 = "test/fixtures/linter/indentation_errors.sql" 1410s fpath2 = "test/fixtures/linter/multiple_sql_errors.sql" 1410s 1410s cmd_args = ( 1410s fpath1, 1410s fpath2, 1410s "--format", 1410s serialize, 1410s "--disable-progress-bar", 1410s ) 1410s 1410s if write_file: 1410s ext = { 1410s "human": ".txt", 1410s "yaml": ".yaml", 1410s } 1410s target_file = os.path.join(tmp_path, write_file + ext.get(serialize, ".json")) 1410s cmd_args += ("--write-output", target_file) 1410s 1410s # note the file is in here twice. two files = two payloads. 1410s > result = invoke_assert_code( 1410s args=[lint, cmd_args], 1410s ret_code=1, 1410s ) 1410s 1410s test/cli/commands_test.py:1644: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ('test/fixtures/linter/indentation_errors.sql', 'test/fixtures/linter/multiple_sql_errors.sql', '--format', 'github-annotation-native', '--disable-progress-bar', '--write-output', ...)] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s ________ test__cli__command_lint_serialize_multiple_files[outfile-none] ________ 1410s 1410s serialize = 'none', write_file = 'outfile' 1410s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_lint_serial11') 1410s 1410s @pytest.mark.parametrize( 1410s "serialize", 1410s ["human", "yaml", "json", "github-annotation", "github-annotation-native", "none"], 1410s ) 1410s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1410s def test__cli__command_lint_serialize_multiple_files(serialize, write_file, tmp_path): 1410s """Test the output formats for multiple files. 1410s 1410s This tests runs both stdout checking and file checking. 1410s """ 1410s fpath1 = "test/fixtures/linter/indentation_errors.sql" 1410s fpath2 = "test/fixtures/linter/multiple_sql_errors.sql" 1410s 1410s cmd_args = ( 1410s fpath1, 1410s fpath2, 1410s "--format", 1410s serialize, 1410s "--disable-progress-bar", 1410s ) 1410s 1410s if write_file: 1410s ext = { 1410s "human": ".txt", 1410s "yaml": ".yaml", 1410s } 1410s target_file = os.path.join(tmp_path, write_file + ext.get(serialize, ".json")) 1410s cmd_args += ("--write-output", target_file) 1410s 1410s # note the file is in here twice. two files = two payloads. 1410s > result = invoke_assert_code( 1410s args=[lint, cmd_args], 1410s ret_code=1, 1410s ) 1410s 1410s test/cli/commands_test.py:1644: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ('test/fixtures/linter/indentation_errors.sql', 'test/fixtures/linter/multiple_sql_errors.sql', '--format', 'none', '--disable-progress-bar', '--write-output', ...)] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _____________ test__cli__command_lint_serialize_github_annotation ______________ 1410s 1410s def test__cli__command_lint_serialize_github_annotation(): 1410s """Test format of github-annotation output.""" 1410s fpath = "test/fixtures/linter/identifier_capitalisation.sql" 1410s > result = invoke_assert_code( 1410s args=[ 1410s lint, 1410s ( 1410s fpath, 1410s "--format", 1410s "github-annotation", 1410s "--annotation-level", 1410s "warning", 1410s "--disable-progress-bar", 1410s ), 1410s ], 1410s ret_code=1, 1410s ) 1410s 1410s test/cli/commands_test.py:1690: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ('test/fixtures/linter/identifier_capitalisation.sql', '--format', 'github-annotation', '--annotation-level', 'warning', '--disable-progress-bar')] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _ test__cli__command_lint_serialize_github_annotation_native[test/fixtures/linter/identifier_capitalisation.sql-::group::{filename}\n::error title=SQLFluff,file={filename},line=3,col=5,endLine=3,endColumn=8::RF02: Unqualified reference 'foo' found in select with more than one referenced table/view. [references.qualification]\n::error title=SQLFluff,file={filename},line=4,col=1,endLine=4,endColumn=5::LT02: Expected indent of 8 spaces. [layout.indent]\n::error title=SQLFluff,file={filename},line=4,col=5,endLine=4,endColumn=8::AL02: Implicit/explicit aliasing of columns. [aliasing.column]\n::error title=SQLFluff,file={filename},line=4,col=5,endLine=4,endColumn=8::CP02: Unquoted identifiers must be consistently lower case. [capitalisation.identifiers]\n::notice title=SQLFluff,file={filename},line=5,col=1,endLine=5,endColumn=5::CP01: Keywords must be consistently lower case. [capitalisation.keywords]\n::error title=SQLFluff,file={filename},line=5,col=12,endLine=5,endColumn=16::CP02: Unquoted identifiers must be consistently lower case. [capitalisation.identifiers]\n::error title=SQLFluff,file={filename},line=5,col=18,endLine=5,endColumn=22::CP02: Unquoted identifiers must be consistently lower case. [capitalisation.identifiers]\n::endgroup::\n] _ 1410s 1410s filename = 'test/fixtures/linter/identifier_capitalisation.sql' 1410s expected_output = '::group::{filename}\n::error title=SQLFluff,file={filename},line=3,col=5,endLine=3,endColumn=8::RF02: Unqualified ref...endColumn=22::CP02: Unquoted identifiers must be consistently lower case. [capitalisation.identifiers]\n::endgroup::\n' 1410s 1410s @pytest.mark.parametrize( 1410s "filename,expected_output", 1410s [ 1410s ( 1410s "test/fixtures/linter/identifier_capitalisation.sql", 1410s ( 1410s "::group::{filename}\n" 1410s "::error title=SQLFluff,file={filename}," 1410s "line=3,col=5,endLine=3,endColumn=8::" 1410s "RF02: Unqualified reference 'foo' found in select with more than one " 1410s "referenced table/view. [references.qualification]\n" 1410s "::error title=SQLFluff,file={filename}," 1410s "line=4,col=1,endLine=4,endColumn=5::" 1410s "LT02: Expected indent of 8 spaces. [layout.indent]\n" 1410s "::error title=SQLFluff,file={filename}," 1410s "line=4,col=5,endLine=4,endColumn=8::" 1410s "AL02: Implicit/explicit aliasing of columns. [aliasing.column]\n" 1410s "::error title=SQLFluff,file={filename}," 1410s "line=4,col=5,endLine=4,endColumn=8::" 1410s "CP02: Unquoted identifiers must be consistently lower case. " 1410s "[capitalisation.identifiers]\n" 1410s # Warnings should always come through as notices. 1410s "::notice title=SQLFluff,file={filename}," 1410s "line=5,col=1,endLine=5,endColumn=5::" 1410s "CP01: Keywords must be consistently lower case. " 1410s "[capitalisation.keywords]\n" 1410s "::error title=SQLFluff,file={filename}," 1410s "line=5,col=12,endLine=5,endColumn=16::" 1410s "CP02: Unquoted identifiers must be consistently lower case. " 1410s "[capitalisation.identifiers]\n" 1410s "::error title=SQLFluff,file={filename}," 1410s "line=5,col=18,endLine=5,endColumn=22::" 1410s "CP02: Unquoted identifiers must be consistently lower case. " 1410s "[capitalisation.identifiers]\n" 1410s "::endgroup::\n" 1410s # SQLFluff produces trailing newline 1410s ), 1410s ), 1410s ( 1410s "test/fixtures/linter/jinja_spacing.sql", 1410s ( 1410s "::group::{filename}\n" 1410s "::error title=SQLFluff,file={filename}," 1410s "line=3,col=15,endLine=3,endColumn=22::JJ01: " 1410s "Jinja tags should have a single whitespace on either " 1410s # NOTE: Double escaping, because we're going to pass this through a 1410s # .format() method. 1410s "side: {{{{foo}}}} " 1410s "[jinja.padding]\n" 1410s "::endgroup::\n" 1410s ), 1410s ), 1410s ], 1410s ) 1410s def test__cli__command_lint_serialize_github_annotation_native( 1410s filename, expected_output 1410s ): 1410s """Test format of github-annotation output.""" 1410s # Normalise paths to control for OS variance 1410s fpath_normalised = os.path.normpath(filename) 1410s 1410s > result = invoke_assert_code( 1410s args=[ 1410s lint, 1410s ( 1410s filename, 1410s "--format", 1410s "github-annotation-native", 1410s "--annotation-level", 1410s "error", 1410s "--disable-progress-bar", 1410s ), 1410s ], 1410s ret_code=1, 1410s ) 1410s 1410s test/cli/commands_test.py:1863: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ('test/fixtures/linter/identifier_capitalisation.sql', '--format', 'github-annotation-native', '--annotation-level', 'error', '--disable-progress-bar')] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _ test__cli__command_lint_serialize_github_annotation_native[test/fixtures/linter/jinja_spacing.sql-::group::{filename}\n::error title=SQLFluff,file={filename},line=3,col=15,endLine=3,endColumn=22::JJ01: Jinja tags should have a single whitespace on either side: {{{{foo}}}} [jinja.padding]\n::endgroup::\n] _ 1410s 1410s filename = 'test/fixtures/linter/jinja_spacing.sql' 1410s expected_output = '::group::{filename}\n::error title=SQLFluff,file={filename},line=3,col=15,endLine=3,endColumn=22::JJ01: Jinja tags should have a single whitespace on either side: {{{{foo}}}} [jinja.padding]\n::endgroup::\n' 1410s 1410s @pytest.mark.parametrize( 1410s "filename,expected_output", 1410s [ 1410s ( 1410s "test/fixtures/linter/identifier_capitalisation.sql", 1410s ( 1410s "::group::{filename}\n" 1410s "::error title=SQLFluff,file={filename}," 1410s "line=3,col=5,endLine=3,endColumn=8::" 1410s "RF02: Unqualified reference 'foo' found in select with more than one " 1410s "referenced table/view. [references.qualification]\n" 1410s "::error title=SQLFluff,file={filename}," 1410s "line=4,col=1,endLine=4,endColumn=5::" 1410s "LT02: Expected indent of 8 spaces. [layout.indent]\n" 1410s "::error title=SQLFluff,file={filename}," 1410s "line=4,col=5,endLine=4,endColumn=8::" 1410s "AL02: Implicit/explicit aliasing of columns. [aliasing.column]\n" 1410s "::error title=SQLFluff,file={filename}," 1410s "line=4,col=5,endLine=4,endColumn=8::" 1410s "CP02: Unquoted identifiers must be consistently lower case. " 1410s "[capitalisation.identifiers]\n" 1410s # Warnings should always come through as notices. 1410s "::notice title=SQLFluff,file={filename}," 1410s "line=5,col=1,endLine=5,endColumn=5::" 1410s "CP01: Keywords must be consistently lower case. " 1410s "[capitalisation.keywords]\n" 1410s "::error title=SQLFluff,file={filename}," 1410s "line=5,col=12,endLine=5,endColumn=16::" 1410s "CP02: Unquoted identifiers must be consistently lower case. " 1410s "[capitalisation.identifiers]\n" 1410s "::error title=SQLFluff,file={filename}," 1410s "line=5,col=18,endLine=5,endColumn=22::" 1410s "CP02: Unquoted identifiers must be consistently lower case. " 1410s "[capitalisation.identifiers]\n" 1410s "::endgroup::\n" 1410s # SQLFluff produces trailing newline 1410s ), 1410s ), 1410s ( 1410s "test/fixtures/linter/jinja_spacing.sql", 1410s ( 1410s "::group::{filename}\n" 1410s "::error title=SQLFluff,file={filename}," 1410s "line=3,col=15,endLine=3,endColumn=22::JJ01: " 1410s "Jinja tags should have a single whitespace on either " 1410s # NOTE: Double escaping, because we're going to pass this through a 1410s # .format() method. 1410s "side: {{{{foo}}}} " 1410s "[jinja.padding]\n" 1410s "::endgroup::\n" 1410s ), 1410s ), 1410s ], 1410s ) 1410s def test__cli__command_lint_serialize_github_annotation_native( 1410s filename, expected_output 1410s ): 1410s """Test format of github-annotation output.""" 1410s # Normalise paths to control for OS variance 1410s fpath_normalised = os.path.normpath(filename) 1410s 1410s > result = invoke_assert_code( 1410s args=[ 1410s lint, 1410s ( 1410s filename, 1410s "--format", 1410s "github-annotation-native", 1410s "--annotation-level", 1410s "error", 1410s "--disable-progress-bar", 1410s ), 1410s ], 1410s ret_code=1, 1410s ) 1410s 1410s test/cli/commands_test.py:1863: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ('test/fixtures/linter/jinja_spacing.sql', '--format', 'github-annotation-native', '--annotation-level', 'error', '--disable-progress-bar')] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _ test__cli__command_lint_serialize_annotation_level_error_failure_equivalent[github-annotation] _ 1410s 1410s serialize = 'github-annotation' 1410s 1410s @pytest.mark.parametrize("serialize", ["github-annotation", "github-annotation-native"]) 1410s def test__cli__command_lint_serialize_annotation_level_error_failure_equivalent( 1410s serialize, 1410s ): 1410s """Test format of github-annotation output.""" 1410s fpath = "test/fixtures/linter/identifier_capitalisation.sql" 1410s > result_error = invoke_assert_code( 1410s args=[ 1410s lint, 1410s ( 1410s fpath, 1410s "--format", 1410s serialize, 1410s "--annotation-level", 1410s "error", 1410s "--disable-progress-bar", 1410s ), 1410s ], 1410s ret_code=1, 1410s ) 1410s 1410s test/cli/commands_test.py:1886: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ('test/fixtures/linter/identifier_capitalisation.sql', '--format', 'github-annotation', '--annotation-level', 'error', '--disable-progress-bar')] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _ test__cli__command_lint_serialize_annotation_level_error_failure_equivalent[github-annotation-native] _ 1410s 1410s serialize = 'github-annotation-native' 1410s 1410s @pytest.mark.parametrize("serialize", ["github-annotation", "github-annotation-native"]) 1410s def test__cli__command_lint_serialize_annotation_level_error_failure_equivalent( 1410s serialize, 1410s ): 1410s """Test format of github-annotation output.""" 1410s fpath = "test/fixtures/linter/identifier_capitalisation.sql" 1410s > result_error = invoke_assert_code( 1410s args=[ 1410s lint, 1410s ( 1410s fpath, 1410s "--format", 1410s serialize, 1410s "--annotation-level", 1410s "error", 1410s "--disable-progress-bar", 1410s ), 1410s ], 1410s ret_code=1, 1410s ) 1410s 1410s test/cli/commands_test.py:1886: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ('test/fixtures/linter/identifier_capitalisation.sql', '--format', 'github-annotation-native', '--annotation-level', 'error', '--disable-progress-bar')] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s __________________________ test_encoding[utf-8-ascii] __________________________ 1410s 1410s encoding_in = 'utf-8', encoding_out = 'ascii' 1410s 1410s @pytest.mark.parametrize( 1410s "encoding_in,encoding_out", 1410s [ 1410s ("utf-8", "ascii"), # chardet will detect ascii as a subset of utf-8 1410s ("utf-8-sig", "UTF-8-SIG"), 1410s ("utf-32", "UTF-32"), 1410s ], 1410s ) 1410s def test_encoding(encoding_in, encoding_out): 1410s """Check the encoding of the test file remains the same after fix is applied.""" 1410s with open("test/fixtures/linter/indentation_errors.sql", "r") as testfile: 1410s > generic_roundtrip_test( 1410s testfile, 1410s "LT01", 1410s input_file_encoding=encoding_in, 1410s output_file_encoding=encoding_out, 1410s ) 1410s 1410s test/cli/commands_test.py:1938: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s test/cli/commands_test.py:928: in generic_roundtrip_test 1410s invoke_assert_code( 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ['--dialect=ansi', '--rules', 'LT01', '/tmp/tmpagydhh0k/testing.sql']] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s ______________________ test_encoding[utf-8-sig-UTF-8-SIG] ______________________ 1410s 1410s encoding_in = 'utf-8-sig', encoding_out = 'UTF-8-SIG' 1410s 1410s @pytest.mark.parametrize( 1410s "encoding_in,encoding_out", 1410s [ 1410s ("utf-8", "ascii"), # chardet will detect ascii as a subset of utf-8 1410s ("utf-8-sig", "UTF-8-SIG"), 1410s ("utf-32", "UTF-32"), 1410s ], 1410s ) 1410s def test_encoding(encoding_in, encoding_out): 1410s """Check the encoding of the test file remains the same after fix is applied.""" 1410s with open("test/fixtures/linter/indentation_errors.sql", "r") as testfile: 1410s > generic_roundtrip_test( 1410s testfile, 1410s "LT01", 1410s input_file_encoding=encoding_in, 1410s output_file_encoding=encoding_out, 1410s ) 1410s 1410s test/cli/commands_test.py:1938: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s test/cli/commands_test.py:928: in generic_roundtrip_test 1410s invoke_assert_code( 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ['--dialect=ansi', '--rules', 'LT01', '/tmp/tmpyramhzd7/testing.sql']] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _________________________ test_encoding[utf-32-UTF-32] _________________________ 1410s 1410s encoding_in = 'utf-32', encoding_out = 'UTF-32' 1410s 1410s @pytest.mark.parametrize( 1410s "encoding_in,encoding_out", 1410s [ 1410s ("utf-8", "ascii"), # chardet will detect ascii as a subset of utf-8 1410s ("utf-8-sig", "UTF-8-SIG"), 1410s ("utf-32", "UTF-32"), 1410s ], 1410s ) 1410s def test_encoding(encoding_in, encoding_out): 1410s """Check the encoding of the test file remains the same after fix is applied.""" 1410s with open("test/fixtures/linter/indentation_errors.sql", "r") as testfile: 1410s > generic_roundtrip_test( 1410s testfile, 1410s "LT01", 1410s input_file_encoding=encoding_in, 1410s output_file_encoding=encoding_out, 1410s ) 1410s 1410s test/cli/commands_test.py:1938: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s test/cli/commands_test.py:928: in generic_roundtrip_test 1410s invoke_assert_code( 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ['--dialect=ansi', '--rules', 'LT01', '/tmp/tmpgv2fo3zs/testing.sql']] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _________________ test_cli_encoding[utf-8-command-line-False] __________________ 1410s 1410s encoding = 'utf-8', method = 'command-line', expect_success = False 1410s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_cli_encoding_utf_8_comman0') 1410s 1410s @pytest.mark.parametrize( 1410s "encoding,method,expect_success", 1410s [ 1410s ("utf-8", "command-line", False), 1410s ("utf-8-SIG", "command-line", True), 1410s ("utf-8", "config-file", False), 1410s ("utf-8-SIG", "config-file", True), 1410s ], 1410s ) 1410s def test_cli_encoding(encoding, method, expect_success, tmpdir): 1410s """Try loading a utf-8-SIG encoded file using the correct encoding via the cli.""" 1410s sql_path = "test/fixtures/cli/encoding_test.sql" 1410s if method == "command-line": 1410s options = [sql_path, "--encoding", encoding] 1410s else: 1410s assert method == "config-file" 1410s with open(str(tmpdir / ".sqlfluff"), "w") as f: 1410s print(f"[sqlfluff]\ndialect=ansi\nencoding = {encoding}", file=f) 1410s shutil.copy(sql_path, tmpdir) 1410s options = [str(tmpdir / "encoding_test.sql")] 1410s > result = invoke_assert_code( 1410s ret_code=1, 1410s args=[ 1410s lint, 1410s options, 1410s ], 1410s ) 1410s 1410s test/cli/commands_test.py:1966: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ['test/fixtures/cli/encoding_test.sql', '--encoding', 'utf-8']] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s ________________ test_cli_encoding[utf-8-SIG-command-line-True] ________________ 1410s 1410s encoding = 'utf-8-SIG', method = 'command-line', expect_success = True 1410s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_cli_encoding_utf_8_SIG_co0') 1410s 1410s @pytest.mark.parametrize( 1410s "encoding,method,expect_success", 1410s [ 1410s ("utf-8", "command-line", False), 1410s ("utf-8-SIG", "command-line", True), 1410s ("utf-8", "config-file", False), 1410s ("utf-8-SIG", "config-file", True), 1410s ], 1410s ) 1410s def test_cli_encoding(encoding, method, expect_success, tmpdir): 1410s """Try loading a utf-8-SIG encoded file using the correct encoding via the cli.""" 1410s sql_path = "test/fixtures/cli/encoding_test.sql" 1410s if method == "command-line": 1410s options = [sql_path, "--encoding", encoding] 1410s else: 1410s assert method == "config-file" 1410s with open(str(tmpdir / ".sqlfluff"), "w") as f: 1410s print(f"[sqlfluff]\ndialect=ansi\nencoding = {encoding}", file=f) 1410s shutil.copy(sql_path, tmpdir) 1410s options = [str(tmpdir / "encoding_test.sql")] 1410s > result = invoke_assert_code( 1410s ret_code=1, 1410s args=[ 1410s lint, 1410s options, 1410s ], 1410s ) 1410s 1410s test/cli/commands_test.py:1966: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ['test/fixtures/cli/encoding_test.sql', '--encoding', 'utf-8-SIG']] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s __________________ test_cli_encoding[utf-8-config-file-False] __________________ 1410s 1410s encoding = 'utf-8', method = 'config-file', expect_success = False 1410s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_cli_encoding_utf_8_config0') 1410s 1410s @pytest.mark.parametrize( 1410s "encoding,method,expect_success", 1410s [ 1410s ("utf-8", "command-line", False), 1410s ("utf-8-SIG", "command-line", True), 1410s ("utf-8", "config-file", False), 1410s ("utf-8-SIG", "config-file", True), 1410s ], 1410s ) 1410s def test_cli_encoding(encoding, method, expect_success, tmpdir): 1410s """Try loading a utf-8-SIG encoded file using the correct encoding via the cli.""" 1410s sql_path = "test/fixtures/cli/encoding_test.sql" 1410s if method == "command-line": 1410s options = [sql_path, "--encoding", encoding] 1410s else: 1410s assert method == "config-file" 1410s with open(str(tmpdir / ".sqlfluff"), "w") as f: 1410s print(f"[sqlfluff]\ndialect=ansi\nencoding = {encoding}", file=f) 1410s shutil.copy(sql_path, tmpdir) 1410s options = [str(tmpdir / "encoding_test.sql")] 1410s > result = invoke_assert_code( 1410s ret_code=1, 1410s args=[ 1410s lint, 1410s options, 1410s ], 1410s ) 1410s 1410s test/cli/commands_test.py:1966: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ['/tmp/pytest-of-ubuntu/pytest-0/test_cli_encoding_utf_8_config0/encoding_test.sql']] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s ________________ test_cli_encoding[utf-8-SIG-config-file-True] _________________ 1410s 1410s encoding = 'utf-8-SIG', method = 'config-file', expect_success = True 1410s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_cli_encoding_utf_8_SIG_co1') 1410s 1410s @pytest.mark.parametrize( 1410s "encoding,method,expect_success", 1410s [ 1410s ("utf-8", "command-line", False), 1410s ("utf-8-SIG", "command-line", True), 1410s ("utf-8", "config-file", False), 1410s ("utf-8-SIG", "config-file", True), 1410s ], 1410s ) 1410s def test_cli_encoding(encoding, method, expect_success, tmpdir): 1410s """Try loading a utf-8-SIG encoded file using the correct encoding via the cli.""" 1410s sql_path = "test/fixtures/cli/encoding_test.sql" 1410s if method == "command-line": 1410s options = [sql_path, "--encoding", encoding] 1410s else: 1410s assert method == "config-file" 1410s with open(str(tmpdir / ".sqlfluff"), "w") as f: 1410s print(f"[sqlfluff]\ndialect=ansi\nencoding = {encoding}", file=f) 1410s shutil.copy(sql_path, tmpdir) 1410s options = [str(tmpdir / "encoding_test.sql")] 1410s > result = invoke_assert_code( 1410s ret_code=1, 1410s args=[ 1410s lint, 1410s options, 1410s ], 1410s ) 1410s 1410s test/cli/commands_test.py:1966: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ['/tmp/pytest-of-ubuntu/pytest-0/test_cli_encoding_utf_8_SIG_co1/encoding_test.sql']] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s ________________________ test_cli_no_disable_noqa_flag _________________________ 1410s 1410s def test_cli_no_disable_noqa_flag(): 1410s """Test that unset --disable-noqa flag respects inline noqa comments.""" 1410s > invoke_assert_code( 1410s ret_code=0, 1410s args=[ 1410s lint, 1410s ["test/fixtures/cli/disable_noqa_test.sql"], 1410s ], 1410s ) 1410s 1410s test/cli/commands_test.py:1984: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 0 1410s args = [, ['test/fixtures/cli/disable_noqa_test.sql']] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s __________________________ test_cli_disable_noqa_flag __________________________ 1410s 1410s def test_cli_disable_noqa_flag(): 1410s """Test that --disable-noqa flag ignores inline noqa comments.""" 1410s > invoke_assert_code( 1410s ret_code=1, 1410s args=[ 1410s lint, 1410s [ 1410s "test/fixtures/cli/disable_noqa_test.sql", 1410s "--disable-noqa", 1410s ], 1410s ], 1410s # Linting error is raised even though it is inline ignored. 1410s assert_output_contains=r"L: 6 | P: 11 | CP01 |", 1410s ) 1410s 1410s test/cli/commands_test.py:1995: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ['test/fixtures/cli/disable_noqa_test.sql', '--disable-noqa']] 1410s kwargs = {}, cli_input = None, mix_stderr = True 1410s assert_output_contains = 'L: 6 | P: 11 | CP01 |', raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s ______________________ test_cli_disable_noqa_except_flag _______________________ 1410s 1410s def test_cli_disable_noqa_except_flag(): 1410s """Test that --disable-noqa-except flag ignores inline noqa comments.""" 1410s > result = invoke_assert_code( 1410s ret_code=1, 1410s args=[ 1410s lint, 1410s [ 1410s "test/fixtures/cli/disable_noqa_test.sql", 1410s "--disable-noqa-except", 1410s "CP01", 1410s ], 1410s ], 1410s # Linting error is raised even though it is inline ignored. 1410s assert_output_contains=r"L: 8 | P: 5 | CP03 |", 1410s ) 1410s 1410s test/cli/commands_test.py:2011: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ['test/fixtures/cli/disable_noqa_test.sql', '--disable-noqa-except', 'CP01']] 1410s kwargs = {}, cli_input = None, mix_stderr = True 1410s assert_output_contains = 'L: 8 | P: 5 | CP03 |', raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _________________ test_cli_disable_noqa_except_non_rules_flag __________________ 1410s 1410s def test_cli_disable_noqa_except_non_rules_flag(): 1410s """Test that --disable-noqa-except flag ignores all inline noqa comments.""" 1410s > invoke_assert_code( 1410s ret_code=1, 1410s args=[ 1410s lint, 1410s [ 1410s "test/fixtures/cli/disable_noqa_test.sql", 1410s "--disable-noqa-except", 1410s "None", 1410s ], 1410s ], 1410s # Linting error is raised even though it is inline ignored. 1410s assert_output_contains=r"L: 6 | P: 11 | CP01 |", 1410s ) 1410s 1410s test/cli/commands_test.py:2029: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ['test/fixtures/cli/disable_noqa_test.sql', '--disable-noqa-except', 'None']] 1410s kwargs = {}, cli_input = None, mix_stderr = True 1410s assert_output_contains = 'L: 6 | P: 11 | CP01 |', raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s ________________________ test_cli_warn_unused_noqa_flag ________________________ 1410s 1410s def test_cli_warn_unused_noqa_flag(): 1410s """Test that --warn-unused-ignores flag works.""" 1410s > invoke_assert_code( 1410s # Return value should still be success. 1410s ret_code=0, 1410s args=[ 1410s lint, 1410s [ 1410s "test/fixtures/cli/disable_noqa_test.sql", 1410s "--warn-unused-ignores", 1410s ], 1410s ], 1410s # Warning shown. 1410s assert_output_contains=( 1410s r"L: 5 | P: 18 | NOQA | WARNING: Unused noqa: 'noqa: CP01'" 1410s ), 1410s ) 1410s 1410s test/cli/commands_test.py:2046: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 0 1410s args = [, ['test/fixtures/cli/disable_noqa_test.sql', '--warn-unused-ignores']] 1410s kwargs = {}, cli_input = None, mix_stderr = True 1410s assert_output_contains = "L: 5 | P: 18 | NOQA | WARNING: Unused noqa: 'noqa: CP01'" 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _____________ TestProgressBars.test_cli_lint_disabled_progress_bar _____________ 1410s 1410s self = 1410s mock_disable_progress_bar = 1410s 1410s def test_cli_lint_disabled_progress_bar( 1410s self, mock_disable_progress_bar: MagicMock 1410s ) -> None: 1410s """When progress bar is disabled, nothing should be printed into output.""" 1410s > result = invoke_assert_code( 1410s args=[ 1410s lint, 1410s [ 1410s "--disable-progress-bar", 1410s "test/fixtures/linter/passing.sql", 1410s ], 1410s ], 1410s ) 1410s 1410s test/cli/commands_test.py:2095: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 0 1410s args = [, ['--disable-progress-bar', 'test/fixtures/linter/passing.sql']] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _____________ TestProgressBars.test_cli_lint_enabled_progress_bar ______________ 1410s 1410s self = 1410s mock_disable_progress_bar = 1410s 1410s def test_cli_lint_enabled_progress_bar( 1410s self, mock_disable_progress_bar: MagicMock 1410s ) -> None: 1410s """When progress bar is enabled, there should be some tracks in output.""" 1410s > result = invoke_assert_code( 1410s args=[ 1410s lint, 1410s [ 1410s "test/fixtures/linter/passing.sql", 1410s ], 1410s ], 1410s ) 1410s 1410s test/cli/commands_test.py:2114: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 0, args = [, ['test/fixtures/linter/passing.sql']] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s ______ TestProgressBars.test_cli_lint_enabled_progress_bar_multiple_paths ______ 1410s 1410s self = 1410s mock_disable_progress_bar = 1410s 1410s def test_cli_lint_enabled_progress_bar_multiple_paths( 1410s self, mock_disable_progress_bar: MagicMock 1410s ) -> None: 1410s """When progress bar is enabled, there should be some tracks in output.""" 1410s > result = invoke_assert_code( 1410s ret_code=1, 1410s args=[ 1410s lint, 1410s [ 1410s "test/fixtures/linter/passing.sql", 1410s "test/fixtures/linter/indentation_errors.sql", 1410s ], 1410s ], 1410s ) 1410s 1410s test/cli/commands_test.py:2132: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ['test/fixtures/linter/passing.sql', 'test/fixtures/linter/indentation_errors.sql']] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s ______ TestProgressBars.test_cli_lint_enabled_progress_bar_multiple_files ______ 1410s 1410s self = 1410s mock_disable_progress_bar = 1410s 1410s def test_cli_lint_enabled_progress_bar_multiple_files( 1410s self, mock_disable_progress_bar: MagicMock 1410s ) -> None: 1410s """When progress bar is enabled, there should be some tracks in output.""" 1410s > result = invoke_assert_code( 1410s args=[ 1410s lint, 1410s [ 1410s "test/fixtures/linter/multiple_files", 1410s ], 1410s ], 1410s ) 1410s 1410s test/cli/commands_test.py:2156: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 0, args = [, ['test/fixtures/linter/multiple_files']] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s ________________ test__cli__fix_multiple_errors_no_show_errors _________________ 1410s 1410s def test__cli__fix_multiple_errors_no_show_errors(): 1410s """Test the fix output.""" 1410s > invoke_assert_code( 1410s ret_code=1, 1410s args=[ 1410s fix, 1410s [ 1410s "--check", # Run in check mode to get the confirmation. 1410s "--disable-progress-bar", 1410s "test/fixtures/linter/multiple_sql_errors.sql", 1410s ], 1410s ], 1410s assert_output_contains=multiple_expected_output, 1410s ) 1410s 1410s test/cli/commands_test.py:2208: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ['--check', '--disable-progress-bar', 'test/fixtures/linter/multiple_sql_errors.sql']] 1410s kwargs = {}, cli_input = None, mix_stderr = True 1410s assert_output_contains = "==== finding fixable violations ====\n== [test/fixtures/linter/multiple_sql_errors.sql] FAIL\nL: 12 | P: 1 | LT02 ... fix these? [Y/n] ...\nInvalid input, please enter 'Y' or 'N'\nAborting...\n [4 unfixable linting violations found]\n" 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s __________________ test__cli__fix_multiple_errors_quiet_force __________________ 1410s 1410s def test__cli__fix_multiple_errors_quiet_force(): 1410s """Test the fix --quiet option with --force.""" 1410s > invoke_assert_code( 1410s ret_code=0, 1410s args=[ 1410s fix, 1410s [ 1410s "--disable-progress-bar", 1410s "test/fixtures/linter/multiple_sql_errors.sql", 1410s "--quiet", 1410s "-x", 1410s "_fix", 1410s ], 1410s ], 1410s assert_output_contains=( 1410s """== [test/fixtures/linter/multiple_sql_errors.sql] FIXED 1410s 2 fixable linting violations found""" 1410s ), 1410s ) 1410s 1410s test/cli/commands_test.py:2224: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 0 1410s args = [, ['--disable-progress-bar', 'test/fixtures/linter/multiple_sql_errors.sql', '--quiet', '-x', '_fix']] 1410s kwargs = {}, cli_input = None, mix_stderr = True 1410s assert_output_contains = '== [test/fixtures/linter/multiple_sql_errors.sql] FIXED\n2 fixable linting violations found' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s __________________ test__cli__fix_multiple_errors_quiet_check __________________ 1410s 1410s def test__cli__fix_multiple_errors_quiet_check(): 1410s """Test the fix --quiet option without --force.""" 1410s > invoke_assert_code( 1410s ret_code=0, 1410s args=[ 1410s fix, 1410s [ 1410s "--disable-progress-bar", 1410s "test/fixtures/linter/multiple_sql_errors.sql", 1410s "--check", # Run in check mode to get the confirmation. 1410s "--quiet", 1410s "-x", 1410s "_fix", 1410s ], 1410s # Test with the confirmation step. 1410s "y", 1410s ], 1410s assert_output_contains=( 1410s """2 fixable linting violations found 1410s Are you sure you wish to attempt to fix these? [Y/n] ... 1410s == [test/fixtures/linter/multiple_sql_errors.sql] FIXED 1410s All Finished""" 1410s ), 1410s ) 1410s 1410s test/cli/commands_test.py:2245: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 0 1410s args = [, ['--disable-progress-bar', 'test/fixtures/linter/multiple_sql_errors.sql', '--check', '--quiet', '-x', '_fix'], 'y'] 1410s kwargs = {}, cli_input = None, mix_stderr = True 1410s assert_output_contains = '2 fixable linting violations found\nAre you sure you wish to attempt to fix these? [Y/n] ...\n== [test/fixtures/linter/multiple_sql_errors.sql] FIXED\nAll Finished' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s __________________ test__cli__fix_multiple_errors_show_errors __________________ 1410s 1410s def test__cli__fix_multiple_errors_show_errors(): 1410s """Test the fix --show-lint-violations option.""" 1410s > result = invoke_assert_code( 1410s ret_code=1, 1410s args=[ 1410s fix, 1410s [ 1410s "--disable-progress-bar", 1410s "--show-lint-violations", 1410s "test/fixtures/linter/multiple_sql_errors.sql", 1410s "--check", # Run in check mode to get the confirmation. 1410s ], 1410s ], 1410s ) 1410s 1410s test/cli/commands_test.py:2271: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ['--disable-progress-bar', '--show-lint-violations', 'test/fixtures/linter/multiple_sql_errors.sql', '--check']] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _______________________ test__cli__fix_show_parse_errors _______________________ 1410s 1410s def test__cli__fix_show_parse_errors(): 1410s """Test the fix --show-lint-violations option with parser error.""" 1410s > result = invoke_assert_code( 1410s ret_code=1, 1410s args=[ 1410s fix, 1410s [ 1410s "--show-lint-violations", 1410s "test/fixtures/linter/parse_lex_error.sql", 1410s ], 1410s ], 1410s ) 1410s 1410s test/cli/commands_test.py:2309: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ['--show-lint-violations', 'test/fixtures/linter/parse_lex_error.sql']] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s __________ test__cli__multiple_files__fix_multiple_errors_show_errors __________ 1410s 1410s def test__cli__multiple_files__fix_multiple_errors_show_errors(): 1410s """Basic check of lint ensures with multiple files, filenames are listed.""" 1410s sql_path = "test/fixtures/linter/multiple_sql_errors.sql" 1410s indent_path = "test/fixtures/linter/indentation_errors.sql" 1410s > result = invoke_assert_code( 1410s ret_code=1, 1410s args=[ 1410s fix, 1410s [ 1410s "--disable-progress-bar", 1410s "--check", # Run in check mode to get the confirmation. 1410s "--show-lint-violations", 1410s sql_path, 1410s indent_path, 1410s ], 1410s ], 1410s ) 1410s 1410s test/cli/commands_test.py:2349: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1 1410s args = [, ['--disable-progress-bar', '--check', '--show-lint-violations', 'test/fixtures/linter/multiple_sql_errors.sql', 'test/fixtures/linter/indentation_errors.sql']] 1410s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s ____________________________ test__cli__render_fail ____________________________ 1410s 1410s def test__cli__render_fail(): 1410s """Basic how render fails.""" 1410s > invoke_assert_code( 1410s ret_code=1, 1410s args=[ 1410s render, 1410s [ 1410s "test/fixtures/cli/fail_many.sql", 1410s ], 1410s ], 1410s assert_output_contains=( 1410s "L: 3 | P: 8 | TMP | Undefined jinja template " "variable: 'something'" 1410s ), 1410s ) 1410s 1410s test/cli/commands_test.py:2379: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 1, args = [, ['test/fixtures/cli/fail_many.sql']] 1410s kwargs = {}, cli_input = None, mix_stderr = True 1410s assert_output_contains = "L: 3 | P: 8 | TMP | Undefined jinja template variable: 'something'" 1410s raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s ____________________________ test__cli__render_pass ____________________________ 1410s 1410s def test__cli__render_pass(): 1410s """Basic how render works.""" 1410s > invoke_assert_code( 1410s ret_code=0, 1410s args=[ 1410s render, 1410s [ 1410s "test/fixtures/templater/jinja_a/jinja.sql", 1410s ], 1410s ], 1410s assert_output_contains="SELECT 56 FROM sch1.tbl2", 1410s ) 1410s 1410s test/cli/commands_test.py:2395: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s ret_code = 0 1410s args = [, ['test/fixtures/templater/jinja_a/jinja.sql']] 1410s kwargs = {}, cli_input = None, mix_stderr = True 1410s assert_output_contains = 'SELECT 56 FROM sch1.tbl2', raise_exceptions = True 1410s 1410s def invoke_assert_code( 1410s ret_code: int = 0, 1410s args: Optional[List[Any]] = None, 1410s kwargs: Optional[Dict[str, Any]] = None, 1410s cli_input: Optional[str] = None, 1410s mix_stderr: bool = True, 1410s assert_output_contains: str = "", 1410s raise_exceptions: bool = True, 1410s ) -> Result: 1410s """Invoke a command and check return code.""" 1410s args = args or [] 1410s kwargs = kwargs or {} 1410s if cli_input: 1410s kwargs["input"] = cli_input 1410s > runner = CliRunner(mix_stderr=mix_stderr) 1410s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1410s _______ test_diff_quality_plugin[sql_paths0-expected_violations_lines0] ________ 1410s 1410s sql_paths = ['linter/indentation_errors.sql'] 1410s expected_violations_lines = [2, 3, 4, 5, 6] 1410s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7426b9daad80> 1410s 1410s @pytest.mark.parametrize( 1410s "sql_paths,expected_violations_lines", 1410s [ 1410s (("linter/indentation_errors.sql",), list(range(2, 7))), 1410s (("linter/parse_error.sql",), {1}), 1410s # NB: This version of the file is in a directory configured 1410s # to ignore parsing errors. 1410s (("linter/diffquality/parse_error.sql",), []), 1410s (tuple(), []), 1410s ], 1410s ) 1410s def test_diff_quality_plugin(sql_paths, expected_violations_lines, monkeypatch): 1410s """Test the plugin at least finds errors on the expected lines.""" 1410s 1410s def execute(command, exit_codes): 1410s printable_command_parts = [ 1410s c.decode(sys.getfilesystemencoding()) if isinstance(c, bytes) else c 1410s for c in command 1410s ] 1410s 1410s result = invoke_assert_code( 1410s ret_code=1 if expected_violations_lines else 0, 1410s args=[ 1410s lint, 1410s printable_command_parts[2:], 1410s ], 1410s ) 1410s return result.output, "" 1410s 1410s # Mock the execute function -- this is an attempt to prevent the CircleCI 1410s # coverage check from hanging. (We've seen issues in the past where using 1410s # subprocesses caused things to occasionally hang.) 1410s monkeypatch.setattr(diff_quality_plugin, "execute", execute) 1410s monkeypatch.chdir("test/fixtures/") 1410s violation_reporter = diff_quality_plugin.diff_cover_report_quality( 1410s options="--processes=1" 1410s ) 1410s assert len(sql_paths) in (0, 1) 1410s sql_paths = [str(Path(sql_path)) for sql_path in sql_paths] 1410s 1410s > violations_dict = violation_reporter.violations_batch(sql_paths) 1410s 1410s /tmp/autopkgtest.KLm779/autopkgtest_tmp/test/diff_quality_plugin_test.py:53: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s self = 1410s src_paths = ['linter/indentation_errors.sql'] 1410s 1410s def violations_batch(self, src_paths): 1410s """Return a dictionary of Violations recorded in `src_paths`.""" 1410s # Check if SQLFluff is installed. 1410s if self.driver_tool_installed is None: 1410s self.driver_tool_installed = self.driver.installed() 1410s if not self.driver_tool_installed: # pragma: no cover 1410s > raise OSError(f"{self.driver.name} is not installed") 1410s E OSError: ['/usr/bin/python3.12', '-m', 'sqlfluff.cli.commands'] is not installed 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/diff_quality_plugin.py:61: OSError 1410s _______ test_diff_quality_plugin[sql_paths1-expected_violations_lines1] ________ 1410s 1410s sql_paths = ['linter/parse_error.sql'], expected_violations_lines = {1} 1410s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7426b9da8a40> 1410s 1410s @pytest.mark.parametrize( 1410s "sql_paths,expected_violations_lines", 1410s [ 1410s (("linter/indentation_errors.sql",), list(range(2, 7))), 1410s (("linter/parse_error.sql",), {1}), 1410s # NB: This version of the file is in a directory configured 1410s # to ignore parsing errors. 1410s (("linter/diffquality/parse_error.sql",), []), 1410s (tuple(), []), 1410s ], 1410s ) 1410s def test_diff_quality_plugin(sql_paths, expected_violations_lines, monkeypatch): 1410s """Test the plugin at least finds errors on the expected lines.""" 1410s 1410s def execute(command, exit_codes): 1410s printable_command_parts = [ 1410s c.decode(sys.getfilesystemencoding()) if isinstance(c, bytes) else c 1410s for c in command 1410s ] 1410s 1410s result = invoke_assert_code( 1410s ret_code=1 if expected_violations_lines else 0, 1410s args=[ 1410s lint, 1410s printable_command_parts[2:], 1410s ], 1410s ) 1410s return result.output, "" 1410s 1410s # Mock the execute function -- this is an attempt to prevent the CircleCI 1410s # coverage check from hanging. (We've seen issues in the past where using 1410s # subprocesses caused things to occasionally hang.) 1410s monkeypatch.setattr(diff_quality_plugin, "execute", execute) 1410s monkeypatch.chdir("test/fixtures/") 1410s violation_reporter = diff_quality_plugin.diff_cover_report_quality( 1410s options="--processes=1" 1410s ) 1410s assert len(sql_paths) in (0, 1) 1410s sql_paths = [str(Path(sql_path)) for sql_path in sql_paths] 1410s 1410s > violations_dict = violation_reporter.violations_batch(sql_paths) 1410s 1410s /tmp/autopkgtest.KLm779/autopkgtest_tmp/test/diff_quality_plugin_test.py:53: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s self = 1410s src_paths = ['linter/parse_error.sql'] 1410s 1410s def violations_batch(self, src_paths): 1410s """Return a dictionary of Violations recorded in `src_paths`.""" 1410s # Check if SQLFluff is installed. 1410s if self.driver_tool_installed is None: 1410s self.driver_tool_installed = self.driver.installed() 1410s if not self.driver_tool_installed: # pragma: no cover 1410s > raise OSError(f"{self.driver.name} is not installed") 1410s E OSError: ['/usr/bin/python3.12', '-m', 'sqlfluff.cli.commands'] is not installed 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/diff_quality_plugin.py:61: OSError 1410s _______ test_diff_quality_plugin[sql_paths2-expected_violations_lines2] ________ 1410s 1410s sql_paths = ['linter/diffquality/parse_error.sql'] 1410s expected_violations_lines = [] 1410s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7426b9dabfb0> 1410s 1410s @pytest.mark.parametrize( 1410s "sql_paths,expected_violations_lines", 1410s [ 1410s (("linter/indentation_errors.sql",), list(range(2, 7))), 1410s (("linter/parse_error.sql",), {1}), 1410s # NB: This version of the file is in a directory configured 1410s # to ignore parsing errors. 1410s (("linter/diffquality/parse_error.sql",), []), 1410s (tuple(), []), 1410s ], 1410s ) 1410s def test_diff_quality_plugin(sql_paths, expected_violations_lines, monkeypatch): 1410s """Test the plugin at least finds errors on the expected lines.""" 1410s 1410s def execute(command, exit_codes): 1410s printable_command_parts = [ 1410s c.decode(sys.getfilesystemencoding()) if isinstance(c, bytes) else c 1410s for c in command 1410s ] 1410s 1410s result = invoke_assert_code( 1410s ret_code=1 if expected_violations_lines else 0, 1410s args=[ 1410s lint, 1410s printable_command_parts[2:], 1410s ], 1410s ) 1410s return result.output, "" 1410s 1410s # Mock the execute function -- this is an attempt to prevent the CircleCI 1410s # coverage check from hanging. (We've seen issues in the past where using 1410s # subprocesses caused things to occasionally hang.) 1410s monkeypatch.setattr(diff_quality_plugin, "execute", execute) 1410s monkeypatch.chdir("test/fixtures/") 1410s violation_reporter = diff_quality_plugin.diff_cover_report_quality( 1410s options="--processes=1" 1410s ) 1410s assert len(sql_paths) in (0, 1) 1410s sql_paths = [str(Path(sql_path)) for sql_path in sql_paths] 1410s 1410s > violations_dict = violation_reporter.violations_batch(sql_paths) 1410s 1410s /tmp/autopkgtest.KLm779/autopkgtest_tmp/test/diff_quality_plugin_test.py:53: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s self = 1410s src_paths = ['linter/diffquality/parse_error.sql'] 1410s 1410s def violations_batch(self, src_paths): 1410s """Return a dictionary of Violations recorded in `src_paths`.""" 1410s # Check if SQLFluff is installed. 1410s if self.driver_tool_installed is None: 1410s self.driver_tool_installed = self.driver.installed() 1410s if not self.driver_tool_installed: # pragma: no cover 1410s > raise OSError(f"{self.driver.name} is not installed") 1410s E OSError: ['/usr/bin/python3.12', '-m', 'sqlfluff.cli.commands'] is not installed 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/diff_quality_plugin.py:61: OSError 1410s _______ test_diff_quality_plugin[sql_paths3-expected_violations_lines3] ________ 1410s 1410s sql_paths = [], expected_violations_lines = [] 1410s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7426b92aafc0> 1410s 1410s @pytest.mark.parametrize( 1410s "sql_paths,expected_violations_lines", 1410s [ 1410s (("linter/indentation_errors.sql",), list(range(2, 7))), 1410s (("linter/parse_error.sql",), {1}), 1410s # NB: This version of the file is in a directory configured 1410s # to ignore parsing errors. 1410s (("linter/diffquality/parse_error.sql",), []), 1410s (tuple(), []), 1410s ], 1410s ) 1410s def test_diff_quality_plugin(sql_paths, expected_violations_lines, monkeypatch): 1410s """Test the plugin at least finds errors on the expected lines.""" 1410s 1410s def execute(command, exit_codes): 1410s printable_command_parts = [ 1410s c.decode(sys.getfilesystemencoding()) if isinstance(c, bytes) else c 1410s for c in command 1410s ] 1410s 1410s result = invoke_assert_code( 1410s ret_code=1 if expected_violations_lines else 0, 1410s args=[ 1410s lint, 1410s printable_command_parts[2:], 1410s ], 1410s ) 1410s return result.output, "" 1410s 1410s # Mock the execute function -- this is an attempt to prevent the CircleCI 1410s # coverage check from hanging. (We've seen issues in the past where using 1410s # subprocesses caused things to occasionally hang.) 1410s monkeypatch.setattr(diff_quality_plugin, "execute", execute) 1410s monkeypatch.chdir("test/fixtures/") 1410s violation_reporter = diff_quality_plugin.diff_cover_report_quality( 1410s options="--processes=1" 1410s ) 1410s assert len(sql_paths) in (0, 1) 1410s sql_paths = [str(Path(sql_path)) for sql_path in sql_paths] 1410s 1410s > violations_dict = violation_reporter.violations_batch(sql_paths) 1410s 1410s /tmp/autopkgtest.KLm779/autopkgtest_tmp/test/diff_quality_plugin_test.py:53: 1410s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1410s 1410s self = 1410s src_paths = [] 1410s 1410s def violations_batch(self, src_paths): 1410s """Return a dictionary of Violations recorded in `src_paths`.""" 1410s # Check if SQLFluff is installed. 1410s if self.driver_tool_installed is None: 1410s self.driver_tool_installed = self.driver.installed() 1410s if not self.driver_tool_installed: # pragma: no cover 1410s > raise OSError(f"{self.driver.name} is not installed") 1410s E OSError: ['/usr/bin/python3.12', '-m', 'sqlfluff.cli.commands'] is not installed 1410s 1410s /usr/lib/python3/dist-packages/sqlfluff/diff_quality_plugin.py:61: OSError 1410s =========================== short test summary info ============================ 1410s FAILED test/cli/commands_test.py::test__cli__command_directed - TypeError: Cl... 1410s FAILED test/cli/commands_test.py::test__cli__command_dialect - TypeError: Cli... 1410s FAILED test/cli/commands_test.py::test__cli__command_no_dialect[command0] - T... 1410s FAILED test/cli/commands_test.py::test__cli__command_no_dialect[command1] - T... 1410s FAILED test/cli/commands_test.py::test__cli__command_no_dialect[command2] - T... 1410s FAILED test/cli/commands_test.py::test__cli__command_no_dialect[command3] - T... 1410s FAILED test/cli/commands_test.py::test__cli__command_no_dialect[command4] - T... 1410s FAILED test/cli/commands_test.py::test__cli__command_parse_error_dialect_explicit_warning 1410s FAILED test/cli/commands_test.py::test__cli__command_parse_error_dialect_implicit_warning 1410s FAILED test/cli/commands_test.py::test__cli__command_dialect_legacy - TypeErr... 1410s FAILED test/cli/commands_test.py::test__cli__command_extra_config_fail - Type... 1410s FAILED test/cli/commands_test.py::test__cli__command_stdin_filename_config[command0-test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql-0-[L: 5, P: 1] | join_clause:\n[L: 5, P: 1] | keyword: 'POSITIONAL'] 1410s FAILED test/cli/commands_test.py::test__cli__command_stdin_filename_config[command1-test/fixtures/an_ansi_config_here.sql-1-Parsing errors found and dialect is set to 'ansi'.] 1410s FAILED test/cli/commands_test.py::test__cli__command_stdin_filename_config[command2-test/fixtures/cli/stdin_filename/stdin_filename.sql-0-All Finished!] 1410s FAILED test/cli/commands_test.py::test__cli__command_stdin_filename_config[command3-test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql-0-All Finished!] 1410s FAILED test/cli/commands_test.py::test__cli__command_stdin_filename_config[command4-test/fixtures/an_ansi_config_here.sql-1-Parsing errors found and dialect is set to 'ansi'.] 1410s FAILED test/cli/commands_test.py::test__cli__command_stdin_filename_config[command5-test/fixtures/cli/stdin_filename/stdin_filename.sql-0-SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n] 1410s FAILED test/cli/commands_test.py::test__cli__command_stdin_filename_config[command6-test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql-0-SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n] 1410s FAILED test/cli/commands_test.py::test__cli__command_stdin_filename_config[command7-test/fixtures/an_ansi_config_here.sql-1-[1 templating/parsing errors found]] 1410s FAILED test/cli/commands_test.py::test__cli__command_stdin_filename_config[command8-test/fixtures/cli/stdin_filename/stdin_filename.sql-0-SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n] 1410s FAILED test/cli/commands_test.py::test__cli__command_stdin_filename_config[command9-test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql-0-SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n] 1410s FAILED test/cli/commands_test.py::test__cli__command_stdin_filename_config[command10-test/fixtures/an_ansi_config_here.sql-1-Unfixable violations detected.] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_stdin[command0] - T... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_stdin[command1] - T... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_stdin[command2] - T... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_stdin[command3] - T... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_empty_stdin - TypeE... 1410s FAILED test/cli/commands_test.py::test__cli__command_render_stdin - TypeError... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command0] - T... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command1] - T... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command2] - T... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command3] - T... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command4] - T... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command5] - T... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command6] - T... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command7] - T... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command8] - T... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command9] - T... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command10] - ... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command11] - ... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command12] - ... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command13] - ... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command14] - ... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command15] - ... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command16] - ... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command17] - ... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command18] - ... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command19] - ... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command20] - ... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command21] - ... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command22] - ... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command23] - ... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command24] - ... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command25] - ... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command26] - ... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command27] - ... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command28] - ... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command29] - ... 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command0-1] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command1-1] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command2-1] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command3-0] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command4-0] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command5-2] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command6-1] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command7-0] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command8-1] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command9-1] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command10-1] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command11-2] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command12-1] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command13-1] 1410s FAILED test/cli/commands_test.py::test__cli__command_rules - TypeError: CliRu... 1410s FAILED test/cli/commands_test.py::test__cli__command_dialects - TypeError: Cl... 1410s FAILED test/cli/commands_test.py::test__cli__command__fix[LT01-test/fixtures/linter/indentation_errors.sql0] 1410s FAILED test/cli/commands_test.py::test__cli__command__fix[LT01-test/fixtures/linter/whitespace_errors.sql] 1410s FAILED test/cli/commands_test.py::test__cli__command__fix[LT01-test/fixtures/linter/indentation_errors.sql1] 1410s FAILED test/cli/commands_test.py::test__cli__command__fix[LT02-test/fixtures/linter/indentation_error_hard.sql] 1410s FAILED test/cli/commands_test.py::test_cli_fix_even_unparsable[command-line-False] 1410s FAILED test/cli/commands_test.py::test_cli_fix_even_unparsable[command-line-True] 1410s FAILED test/cli/commands_test.py::test_cli_fix_even_unparsable[config-file-False] 1410s FAILED test/cli/commands_test.py::test_cli_fix_even_unparsable[config-file-True] 1410s FAILED test/cli/commands_test.py::test__cli__command_fix_stdin[select * from t-LT02-select * from t] 1410s FAILED test/cli/commands_test.py::test__cli__command_fix_stdin[ select * from t-LT02-select * from t] 1410s FAILED test/cli/commands_test.py::test__cli__command_format_stdin[select * from t\n-select * from t\n] 1410s FAILED test/cli/commands_test.py::test__cli__command_format_stdin[ select * FRoM t -select * from t\n] 1410s FAILED test/cli/commands_test.py::test__cli__command_format_stdin[select\n count(*) over (\n order by a desc \n range between b row and '10 seconds' following -- noqa: PRS\n ) as c\nfrom d\n-select\n count(*) over (\n order by a desc \n range between b row and '10 seconds' following -- noqa: PRS\n ) as c\nfrom d\n] 1410s FAILED test/cli/commands_test.py::test__cli__command_fix_stdin_logging_to_stderr 1410s FAILED test/cli/commands_test.py::test__cli__command_fix_stdin_safety - TypeE... 1410s FAILED test/cli/commands_test.py::test__cli__command_fix_stdin_error_exit_code[create TABLE {{ params.dsfsdfds }}.t (a int)-1--v-Fix aborted due to unparsable template variables.] 1410s FAILED test/cli/commands_test.py::test__cli__command_fix_stdin_error_exit_code[create TABLE a.t (a int)-0--] 1410s FAILED test/cli/commands_test.py::test__cli__command_fix_stdin_error_exit_code[create table a.t (a int)-0--] 1410s FAILED test/cli/commands_test.py::test__cli__command_fix_stdin_error_exit_code[select col from a join b using (c)-1--v-Unfixable violations detected.] 1410s FAILED test/cli/commands_test.py::test__cli__command__fix_check[LT01-test/fixtures/linter/indentation_errors.sql-y-0-0] 1410s FAILED test/cli/commands_test.py::test__cli__command__fix_check[LT01-test/fixtures/linter/indentation_errors.sql-n-1-1] 1410s FAILED test/cli/commands_test.py::test__cli__command_parse_serialize_from_stdin[None-yaml] 1410s FAILED test/cli/commands_test.py::test__cli__command_parse_serialize_from_stdin[None-json] 1410s FAILED test/cli/commands_test.py::test__cli__command_parse_serialize_from_stdin[outfile-yaml] 1410s FAILED test/cli/commands_test.py::test__cli__command_parse_serialize_from_stdin[outfile-json] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_from_stdin[select * from tbl-CP01-expected0-0-yaml] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_from_stdin[select * from tbl-CP01-expected0-0-json] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_from_stdin[select * from tbl-CP01-expected0-0-none] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_from_stdin[SElect * from tbl-CP01-expected1-1-yaml] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_from_stdin[SElect * from tbl-CP01-expected1-1-json] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_from_stdin[SElect * from tbl-CP01-expected1-1-none] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_from_stdin[SELECT {{1}}-JJ01-expected2-1-yaml] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_from_stdin[SELECT {{1}}-JJ01-expected2-1-json] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_from_stdin[SELECT {{1}}-JJ01-expected2-1-none] 1410s FAILED test/cli/commands_test.py::test__cli__command_fail_nice_not_found[command0] 1410s FAILED test/cli/commands_test.py::test__cli__command_fail_nice_not_found[command1] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[None-human] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[None-yaml] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[None-json] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[None-github-annotation] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[None-github-annotation-native] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[None-none] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[outfile-human] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[outfile-yaml] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[outfile-json] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[outfile-github-annotation] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[outfile-github-annotation-native] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[outfile-none] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_github_annotation 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_github_annotation_native[test/fixtures/linter/identifier_capitalisation.sql-::group::{filename}\n::error title=SQLFluff,file={filename},line=3,col=5,endLine=3,endColumn=8::RF02: Unqualified reference 'foo' found in select with more than one referenced table/view. [references.qualification]\n::error title=SQLFluff,file={filename},line=4,col=1,endLine=4,endColumn=5::LT02: Expected indent of 8 spaces. [layout.indent]\n::error title=SQLFluff,file={filename},line=4,col=5,endLine=4,endColumn=8::AL02: Implicit/explicit aliasing of columns. [aliasing.column]\n::error title=SQLFluff,file={filename},line=4,col=5,endLine=4,endColumn=8::CP02: Unquoted identifiers must be consistently lower case. [capitalisation.identifiers]\n::notice title=SQLFluff,file={filename},line=5,col=1,endLine=5,endColumn=5::CP01: Keywords must be consistently lower case. [capitalisation.keywords]\n::error title=SQLFluff,file={filename},line=5,col=12,endLine=5,endColumn=16::CP02: Unquoted identifiers must be consistently lower case. [capitalisation.identifiers]\n::error title=SQLFluff,file={filename},line=5,col=18,endLine=5,endColumn=22::CP02: Unquoted identifiers must be consistently lower case. [capitalisation.identifiers]\n::endgroup::\n] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_github_annotation_native[test/fixtures/linter/jinja_spacing.sql-::group::{filename}\n::error title=SQLFluff,file={filename},line=3,col=15,endLine=3,endColumn=22::JJ01: Jinja tags should have a single whitespace on either side: {{{{foo}}}} [jinja.padding]\n::endgroup::\n] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_annotation_level_error_failure_equivalent[github-annotation] 1410s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_annotation_level_error_failure_equivalent[github-annotation-native] 1410s FAILED test/cli/commands_test.py::test_encoding[utf-8-ascii] - TypeError: Cli... 1410s FAILED test/cli/commands_test.py::test_encoding[utf-8-sig-UTF-8-SIG] - TypeEr... 1410s FAILED test/cli/commands_test.py::test_encoding[utf-32-UTF-32] - TypeError: C... 1410s FAILED test/cli/commands_test.py::test_cli_encoding[utf-8-command-line-False] 1410s FAILED test/cli/commands_test.py::test_cli_encoding[utf-8-SIG-command-line-True] 1410s FAILED test/cli/commands_test.py::test_cli_encoding[utf-8-config-file-False] 1410s FAILED test/cli/commands_test.py::test_cli_encoding[utf-8-SIG-config-file-True] 1410s FAILED test/cli/commands_test.py::test_cli_no_disable_noqa_flag - TypeError: ... 1410s FAILED test/cli/commands_test.py::test_cli_disable_noqa_flag - TypeError: Cli... 1410s FAILED test/cli/commands_test.py::test_cli_disable_noqa_except_flag - TypeErr... 1410s FAILED test/cli/commands_test.py::test_cli_disable_noqa_except_non_rules_flag 1410s FAILED test/cli/commands_test.py::test_cli_warn_unused_noqa_flag - TypeError:... 1410s FAILED test/cli/commands_test.py::TestProgressBars::test_cli_lint_disabled_progress_bar 1410s FAILED test/cli/commands_test.py::TestProgressBars::test_cli_lint_enabled_progress_bar 1410s FAILED test/cli/commands_test.py::TestProgressBars::test_cli_lint_enabled_progress_bar_multiple_paths 1410s FAILED test/cli/commands_test.py::TestProgressBars::test_cli_lint_enabled_progress_bar_multiple_files 1410s FAILED test/cli/commands_test.py::test__cli__fix_multiple_errors_no_show_errors 1410s FAILED test/cli/commands_test.py::test__cli__fix_multiple_errors_quiet_force 1410s FAILED test/cli/commands_test.py::test__cli__fix_multiple_errors_quiet_check 1410s FAILED test/cli/commands_test.py::test__cli__fix_multiple_errors_show_errors 1410s FAILED test/cli/commands_test.py::test__cli__fix_show_parse_errors - TypeErro... 1410s FAILED test/cli/commands_test.py::test__cli__multiple_files__fix_multiple_errors_show_errors 1410s FAILED test/cli/commands_test.py::test__cli__render_fail - TypeError: CliRunn... 1410s FAILED test/cli/commands_test.py::test__cli__render_pass - TypeError: CliRunn... 1410s FAILED test/diff_quality_plugin_test.py::test_diff_quality_plugin[sql_paths0-expected_violations_lines0] 1410s FAILED test/diff_quality_plugin_test.py::test_diff_quality_plugin[sql_paths1-expected_violations_lines1] 1410s FAILED test/diff_quality_plugin_test.py::test_diff_quality_plugin[sql_paths2-expected_violations_lines2] 1410s FAILED test/diff_quality_plugin_test.py::test_diff_quality_plugin[sql_paths3-expected_violations_lines3] 1410s ==== 155 failed, 8364 passed, 1 skipped, 1 deselected in 1332.54s (0:22:12) ==== 1413s autopkgtest [04:39:49]: test upstream: -----------------------] 1413s autopkgtest [04:39:49]: test upstream: - - - - - - - - - - results - - - - - - - - - - 1413s upstream FAIL non-zero exit status 1 1413s autopkgtest [04:39:49]: @@@@@@@@@@@@@@@@@@@@ summary 1413s upstream FAIL non-zero exit status 1 1432s nova [W] Skipping flock for amd64 1432s Creating nova instance adt-plucky-amd64-sqlfluff-20250219-041615-juju-7f2275-prod-proposed-migration-environment-20-7aca3b81-866d-4c11-827f-199c44e599a0 from image adt/ubuntu-plucky-amd64-server-20250218.img (UUID 0c5f6311-785d-4524-a0d8-db541aaf5c09)... 1432s nova [W] Timed out waiting for 5c209590-1bd6-4b8a-b515-1ba11861416c to get deleted.