0s autopkgtest [06:58:59]: starting date and time: 2025-02-19 06:58:59+0000 0s autopkgtest [06:58:59]: git checkout: 325255d2 Merge branch 'pin-any-arch' into 'ubuntu/production' 0s autopkgtest [06:58:59]: host juju-7f2275-prod-proposed-migration-environment-15; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.k8wkpafo/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-ppc64el --security-groups autopkgtest-juju-7f2275-prod-proposed-migration-environment-15@bos03-ppc64el-9.secgroup --name adt-plucky-ppc64el-sqlfluff-20250219-065859-juju-7f2275-prod-proposed-migration-environment-15-6b0ed0cb-ae0b-4912-9fae-d99614d37688 --image adt/ubuntu-plucky-ppc64el-server --keyname testbed-juju-7f2275-prod-proposed-migration-environment-15 --net-id=net_prod-proposed-migration-ppc64el -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/ 73s autopkgtest [07:00:12]: testbed dpkg architecture: ppc64el 73s autopkgtest [07:00:12]: testbed apt version: 2.9.29 73s autopkgtest [07:00:12]: @@@@@@@@@@@@@@@@@@@@ test bed setup 73s autopkgtest [07:00:12]: testbed release detected to be: None 74s autopkgtest [07:00:13]: updating testbed package index (apt update) 74s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed InRelease [110 kB] 75s Hit:2 http://ftpmaster.internal/ubuntu plucky InRelease 75s Hit:3 http://ftpmaster.internal/ubuntu plucky-updates InRelease 75s Hit:4 http://ftpmaster.internal/ubuntu plucky-security InRelease 75s Get:5 http://ftpmaster.internal/ubuntu plucky-proposed/main Sources [76.2 kB] 75s Get:6 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse Sources [14.6 kB] 75s Get:7 http://ftpmaster.internal/ubuntu plucky-proposed/universe Sources [770 kB] 75s Get:8 http://ftpmaster.internal/ubuntu plucky-proposed/restricted Sources [3120 B] 75s Get:9 http://ftpmaster.internal/ubuntu plucky-proposed/main ppc64el Packages [95.3 kB] 75s Get:10 http://ftpmaster.internal/ubuntu plucky-proposed/restricted ppc64el Packages [760 B] 75s Get:11 http://ftpmaster.internal/ubuntu plucky-proposed/universe ppc64el Packages [666 kB] 75s Get:12 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse ppc64el Packages [6324 B] 75s Fetched 1742 kB in 1s (1657 kB/s) 76s Reading package lists... 77s + lsb_release --codename --short 77s + RELEASE=plucky 77s + cat 77s + [ plucky != trusty ] 77s + DEBIAN_FRONTEND=noninteractive eatmydata apt-get -y --allow-downgrades -o Dpkg::Options::=--force-confnew dist-upgrade 77s Reading package lists... 77s Building dependency tree... 77s Reading state information... 77s Calculating upgrade... 77s The following NEW packages will be installed: 77s libapt-pkg7.0 77s The following packages will be upgraded: 77s apt apt-utils dhcpcd-base rsyslog 77s 4 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. 77s Need to get 3731 kB of archives. 77s After this operation, 3926 kB of additional disk space will be used. 77s Get:1 http://ftpmaster.internal/ubuntu plucky/main ppc64el libapt-pkg7.0 ppc64el 2.9.30 [1152 kB] 78s Get:2 http://ftpmaster.internal/ubuntu plucky/main ppc64el apt ppc64el 2.9.30 [1439 kB] 78s Get:3 http://ftpmaster.internal/ubuntu plucky/main ppc64el apt-utils ppc64el 2.9.30 [228 kB] 78s Get:4 http://ftpmaster.internal/ubuntu plucky/main ppc64el dhcpcd-base ppc64el 1:10.1.0-7 [280 kB] 78s Get:5 http://ftpmaster.internal/ubuntu plucky/main ppc64el rsyslog ppc64el 8.2412.0-2ubuntu1 [632 kB] 78s Fetched 3731 kB in 1s (5246 kB/s) 78s Selecting previously unselected package libapt-pkg7.0:ppc64el. 79s (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 ... 106322 files and directories currently installed.) 79s Preparing to unpack .../libapt-pkg7.0_2.9.30_ppc64el.deb ... 79s Unpacking libapt-pkg7.0:ppc64el (2.9.30) ... 79s Setting up libapt-pkg7.0:ppc64el (2.9.30) ... 79s (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 ... 106371 files and directories currently installed.) 79s Preparing to unpack .../apt_2.9.30_ppc64el.deb ... 79s Unpacking apt (2.9.30) over (2.9.29) ... 79s Setting up apt (2.9.30) ... 80s (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 ... 106371 files and directories currently installed.) 80s Preparing to unpack .../apt-utils_2.9.30_ppc64el.deb ... 80s Unpacking apt-utils (2.9.30) over (2.9.29) ... 80s Preparing to unpack .../dhcpcd-base_1%3a10.1.0-7_ppc64el.deb ... 80s Unpacking dhcpcd-base (1:10.1.0-7) over (1:10.1.0-6) ... 80s Preparing to unpack .../rsyslog_8.2412.0-2ubuntu1_ppc64el.deb ... 80s Unpacking rsyslog (8.2412.0-2ubuntu1) over (8.2412.0-1ubuntu1) ... 80s Setting up apt-utils (2.9.30) ... 80s Setting up rsyslog (8.2412.0-2ubuntu1) ... 80s info: The user `syslog' is already a member of `adm'. 81s Setting up dhcpcd-base (1:10.1.0-7) ... 81s Processing triggers for man-db (2.13.0-1) ... 83s Processing triggers for libc-bin (2.40-4ubuntu1) ... 83s + rm /etc/apt/preferences.d/force-downgrade-to-release.pref 83s + /usr/lib/apt/apt-helper analyze-pattern ?true 83s + uname -r 83s + sed s/\./\\./g 83s + running_kernel_pattern=^linux-.*6\.12\.0-15-generic.* 83s + apt list ?obsolete 83s + tail -n+2 83s + cut -d/ -f1 83s + grep -v ^linux-.*6\.12\.0-15-generic.* 84s + true 84s + obsolete_pkgs= 84s + DEBIAN_FRONTEND=noninteractive eatmydata apt-get -y purge --autoremove 84s Reading package lists... 85s Building dependency tree... 85s Reading state information... 85s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 85s + grep -q trusty /etc/lsb-release 85s + [ ! -d /usr/share/doc/unattended-upgrades ] 85s + [ ! -d /usr/share/doc/lxd ] 85s + [ ! -d /usr/share/doc/lxd-client ] 85s + [ ! -d /usr/share/doc/snapd ] 85s + type iptables 85s + cat 85s + chmod 755 /etc/rc.local 85s + . /etc/rc.local 85s + iptables -w -t mangle -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu 85s + iptables -A OUTPUT -d 10.255.255.1/32 -p tcp -j DROP 85s + iptables -A OUTPUT -d 10.255.255.2/32 -p tcp -j DROP 85s + uname -m 85s + [ ppc64le = ppc64le ] 85s + systemctl is-active keyboard-setup.service 85s + [ active = failed ] 85s + [ -d /run/systemd/system ] 85s + systemd-detect-virt --quiet --vm 85s + mkdir -p /etc/systemd/system/systemd-random-seed.service.d/ 85s + cat 85s + grep -q lz4 /etc/initramfs-tools/initramfs.conf 85s + echo COMPRESS=lz4 85s autopkgtest [07:00:24]: upgrading testbed (apt dist-upgrade and autopurge) 85s Reading package lists... 85s Building dependency tree... 85s Reading state information... 86s Calculating upgrade...Starting pkgProblemResolver with broken count: 0 86s Starting 2 pkgProblemResolver with broken count: 0 86s Done 86s Entering ResolveByKeep 87s 87s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 87s Reading package lists... 87s Building dependency tree... 87s Reading state information... 88s Starting pkgProblemResolver with broken count: 0 88s Starting 2 pkgProblemResolver with broken count: 0 88s Done 88s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 88s autopkgtest [07:00:27]: rebooting testbed after setup commands that affected boot 119s autopkgtest [07:00:58]: testbed running kernel: Linux 6.12.0-15-generic #15-Ubuntu SMP Tue Feb 4 16:32:08 UTC 2025 121s autopkgtest [07:01:00]: @@@@@@@@@@@@@@@@@@@@ apt-source sqlfluff 124s Get:1 http://ftpmaster.internal/ubuntu plucky/universe sqlfluff 3.3.1-1 (dsc) [3968 B] 124s Get:2 http://ftpmaster.internal/ubuntu plucky/universe sqlfluff 3.3.1-1 (tar) [2961 kB] 124s Get:3 http://ftpmaster.internal/ubuntu plucky/universe sqlfluff 3.3.1-1 (diff) [9076 B] 124s gpgv: Signature made Sun Feb 9 16:45:26 2025 UTC 124s gpgv: using RSA key AC0A4FF12611B6FCCF01C111393587D97D86500B 124s gpgv: Can't check signature: No public key 124s dpkg-source: warning: cannot verify inline signature for ./sqlfluff_3.3.1-1.dsc: no acceptable signature found 125s autopkgtest [07:01:04]: testing package sqlfluff version 3.3.1-1 125s autopkgtest [07:01:04]: build not needed 126s autopkgtest [07:01:05]: test upstream: preparing testbed 126s Reading package lists... 127s Building dependency tree... 127s Reading state information... 127s Starting pkgProblemResolver with broken count: 0 127s Starting 2 pkgProblemResolver with broken count: 0 127s Done 127s The following NEW packages will be installed: 127s diff-cover python3-all python3-click python3-colorama python3-dateutil 127s python3-hypothesis python3-iniconfig python3-packaging python3-pathspec 127s python3-platformdirs python3-pluggy python3-pytest python3-regex 127s python3-sortedcontainers python3-tblib python3-tqdm python3.12 127s python3.12-minimal sqlfluff 127s 0 upgraded, 19 newly installed, 0 to remove and 0 not upgraded. 127s Need to get 5213 kB of archives. 127s After this operation, 21.8 MB of additional disk space will be used. 127s Get:1 http://ftpmaster.internal/ubuntu plucky/main ppc64el python3.12-minimal ppc64el 3.12.9-1 [2465 kB] 128s Get:2 http://ftpmaster.internal/ubuntu plucky/main ppc64el python3.12 ppc64el 3.12.9-1 [671 kB] 128s Get:3 http://ftpmaster.internal/ubuntu plucky/universe ppc64el python3-pluggy all 1.5.0-1 [21.0 kB] 128s Get:4 http://ftpmaster.internal/ubuntu plucky/universe ppc64el diff-cover all 9.2.2-1 [44.2 kB] 128s Get:5 http://ftpmaster.internal/ubuntu plucky/main ppc64el python3-all ppc64el 3.13.1-1~exp2 [896 B] 128s Get:6 http://ftpmaster.internal/ubuntu plucky-proposed/main ppc64el python3-click all 8.2.0-1 [81.9 kB] 128s Get:7 http://ftpmaster.internal/ubuntu plucky/universe ppc64el python3-colorama all 0.4.6-4 [32.1 kB] 128s Get:8 http://ftpmaster.internal/ubuntu plucky/main ppc64el python3-dateutil all 2.9.0-3 [80.2 kB] 128s Get:9 http://ftpmaster.internal/ubuntu plucky/main ppc64el python3-sortedcontainers all 2.4.0-2 [27.6 kB] 128s Get:10 http://ftpmaster.internal/ubuntu plucky/universe ppc64el python3-hypothesis all 6.125.2-1 [333 kB] 128s Get:11 http://ftpmaster.internal/ubuntu plucky/universe ppc64el python3-iniconfig all 1.1.1-2 [6024 B] 128s Get:12 http://ftpmaster.internal/ubuntu plucky/main ppc64el python3-packaging all 24.2-1 [51.5 kB] 128s Get:13 http://ftpmaster.internal/ubuntu plucky/universe ppc64el python3-pathspec all 0.12.1-1 [24.5 kB] 128s Get:14 http://ftpmaster.internal/ubuntu plucky/main ppc64el python3-platformdirs all 4.3.6-1 [16.8 kB] 128s Get:15 http://ftpmaster.internal/ubuntu plucky/universe ppc64el python3-pytest all 8.3.4-1 [252 kB] 128s Get:16 http://ftpmaster.internal/ubuntu plucky/universe ppc64el python3-regex ppc64el 0.1.20241106-1 [335 kB] 128s Get:17 http://ftpmaster.internal/ubuntu plucky/universe ppc64el python3-tblib all 3.0.0-6 [13.0 kB] 128s Get:18 http://ftpmaster.internal/ubuntu plucky/universe ppc64el python3-tqdm all 4.67.1-2 [92.5 kB] 128s Get:19 http://ftpmaster.internal/ubuntu plucky/universe ppc64el sqlfluff all 3.3.1-1 [665 kB] 128s Fetched 5213 kB in 1s (6126 kB/s) 128s Selecting previously unselected package python3.12-minimal. 128s (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 ... 106371 files and directories currently installed.) 128s Preparing to unpack .../00-python3.12-minimal_3.12.9-1_ppc64el.deb ... 128s Unpacking python3.12-minimal (3.12.9-1) ... 128s Selecting previously unselected package python3.12. 128s Preparing to unpack .../01-python3.12_3.12.9-1_ppc64el.deb ... 128s Unpacking python3.12 (3.12.9-1) ... 128s Selecting previously unselected package python3-pluggy. 128s Preparing to unpack .../02-python3-pluggy_1.5.0-1_all.deb ... 128s Unpacking python3-pluggy (1.5.0-1) ... 128s Selecting previously unselected package diff-cover. 128s Preparing to unpack .../03-diff-cover_9.2.2-1_all.deb ... 128s Unpacking diff-cover (9.2.2-1) ... 129s Selecting previously unselected package python3-all. 129s Preparing to unpack .../04-python3-all_3.13.1-1~exp2_ppc64el.deb ... 129s Unpacking python3-all (3.13.1-1~exp2) ... 129s Selecting previously unselected package python3-click. 129s Preparing to unpack .../05-python3-click_8.2.0-1_all.deb ... 129s Unpacking python3-click (8.2.0-1) ... 129s Selecting previously unselected package python3-colorama. 129s Preparing to unpack .../06-python3-colorama_0.4.6-4_all.deb ... 129s Unpacking python3-colorama (0.4.6-4) ... 129s Selecting previously unselected package python3-dateutil. 129s Preparing to unpack .../07-python3-dateutil_2.9.0-3_all.deb ... 129s Unpacking python3-dateutil (2.9.0-3) ... 129s Selecting previously unselected package python3-sortedcontainers. 129s Preparing to unpack .../08-python3-sortedcontainers_2.4.0-2_all.deb ... 129s Unpacking python3-sortedcontainers (2.4.0-2) ... 129s Selecting previously unselected package python3-hypothesis. 129s Preparing to unpack .../09-python3-hypothesis_6.125.2-1_all.deb ... 129s Unpacking python3-hypothesis (6.125.2-1) ... 129s Selecting previously unselected package python3-iniconfig. 129s Preparing to unpack .../10-python3-iniconfig_1.1.1-2_all.deb ... 129s Unpacking python3-iniconfig (1.1.1-2) ... 129s Selecting previously unselected package python3-packaging. 129s Preparing to unpack .../11-python3-packaging_24.2-1_all.deb ... 129s Unpacking python3-packaging (24.2-1) ... 129s Selecting previously unselected package python3-pathspec. 129s Preparing to unpack .../12-python3-pathspec_0.12.1-1_all.deb ... 129s Unpacking python3-pathspec (0.12.1-1) ... 129s Selecting previously unselected package python3-platformdirs. 129s Preparing to unpack .../13-python3-platformdirs_4.3.6-1_all.deb ... 129s Unpacking python3-platformdirs (4.3.6-1) ... 129s Selecting previously unselected package python3-pytest. 129s Preparing to unpack .../14-python3-pytest_8.3.4-1_all.deb ... 129s Unpacking python3-pytest (8.3.4-1) ... 129s Selecting previously unselected package python3-regex. 129s Preparing to unpack .../15-python3-regex_0.1.20241106-1_ppc64el.deb ... 129s Unpacking python3-regex (0.1.20241106-1) ... 129s Selecting previously unselected package python3-tblib. 129s Preparing to unpack .../16-python3-tblib_3.0.0-6_all.deb ... 129s Unpacking python3-tblib (3.0.0-6) ... 129s Selecting previously unselected package python3-tqdm. 129s Preparing to unpack .../17-python3-tqdm_4.67.1-2_all.deb ... 129s Unpacking python3-tqdm (4.67.1-2) ... 129s Selecting previously unselected package sqlfluff. 129s Preparing to unpack .../18-sqlfluff_3.3.1-1_all.deb ... 129s Unpacking sqlfluff (3.3.1-1) ... 129s Setting up python3-iniconfig (1.1.1-2) ... 129s Setting up python3.12-minimal (3.12.9-1) ... 130s Setting up python3-tblib (3.0.0-6) ... 130s Setting up python3-colorama (0.4.6-4) ... 130s Setting up python3.12 (3.12.9-1) ... 132s Setting up python3-tqdm (4.67.1-2) ... 132s Setting up python3-all (3.13.1-1~exp2) ... 132s Setting up python3-sortedcontainers (2.4.0-2) ... 132s Setting up python3-click (8.2.0-1) ... 132s Setting up python3-platformdirs (4.3.6-1) ... 132s Setting up python3-packaging (24.2-1) ... 133s Setting up python3-regex (0.1.20241106-1) ... 133s Setting up python3-pluggy (1.5.0-1) ... 133s Setting up python3-dateutil (2.9.0-3) ... 133s Setting up diff-cover (9.2.2-1) ... 134s Setting up python3-pathspec (0.12.1-1) ... 134s Setting up python3-pytest (8.3.4-1) ... 134s Setting up python3-hypothesis (6.125.2-1) ... 135s Setting up sqlfluff (3.3.1-1) ... 136s Processing triggers for man-db (2.13.0-1) ... 137s Processing triggers for systemd (257.2-3ubuntu1) ... 138s autopkgtest [07:01:17]: test upstream: [----------------------- 138s + cp -a -t /tmp/autopkgtest.oASYaB/autopkgtest_tmp test pyproject.toml README.md plugins 139s + cd /tmp/autopkgtest.oASYaB/autopkgtest_tmp 139s + rm test/core/plugin_test.py 139s + py3versions -s 139s =-=-=-=-=-= Running tests for python3.12 =-=-=-=-=-= 139s + printf =-=-=-=-=-= Running tests for %s =-=-=-=-=-=\n python3.12 139s + python3.12 -m pytest -k not appdir test 145s ============================= test session starts ============================== 145s platform linux -- Python 3.12.9, pytest-8.3.4, pluggy-1.5.0 145s rootdir: /tmp/autopkgtest.oASYaB/autopkgtest_tmp 145s configfile: pyproject.toml 145s plugins: typeguard-4.4.1, hypothesis-6.125.2 145s collected 8521 items / 1 deselected / 8520 selected 145s 145s test/api/classes_test.py .... [ 0%] 145s test/api/info_test.py .. [ 0%] 147s test/api/simple_test.py ................... [ 0%] 147s test/cli/autocomplete_test.py ..... [ 0%] 148s test/cli/commands_test.py FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF [ 0%] 151s FFFFFFFFFFFFFFFFFFFFFFFFFF.......FFFFFF.......FFFFFFFFFFFFFFFFFFFFFFFFFF [ 1%] 153s FFFFFF.FFFFFFFFFFFFFFFFF.FFFFFFFFFFFF.FFFFFFFFFFFF [ 2%] 153s test/cli/formatters_test.py ..... [ 2%] 153s test/cli/helpers_test.py ......... [ 2%] 153s test/core/config/fluffconfig_test.py ........................... [ 2%] 153s test/core/config/loader_test.py ............. [ 2%] 153s test/core/config/validate_test.py ....... [ 3%] 153s test/core/errors_test.py ...... [ 3%] 153s test/core/helpers/dict_test.py ..... [ 3%] 153s test/core/helpers/file_test.py .........s. [ 3%] 153s test/core/helpers/slice_test.py ...................... [ 3%] 153s test/core/helpers/string_test.py ....... [ 3%] 153s test/core/linter/discovery_test.py ............... [ 3%] 153s test/core/linter/fix_test.py ...... [ 3%] 154s test/core/linter/linted_file_test.py ................. [ 4%] 157s test/core/linter/linter_test.py ........................................ [ 4%] 157s ... [ 4%] 157s test/core/parser/grammar/grammar_anyof_test.py ................ [ 4%] 157s test/core/parser/grammar/grammar_other_test.py ......................... [ 5%] 157s ... [ 5%] 157s test/core/parser/grammar/grammar_ref_test.py .... [ 5%] 158s test/core/parser/grammar/grammar_sequence_test.py ...................... [ 5%] 158s ..................... [ 5%] 158s test/core/parser/helpers_test.py .... [ 5%] 158s test/core/parser/lexer_test.py .............................. [ 6%] 158s test/core/parser/markers_test.py ......... [ 6%] 158s test/core/parser/match_algorithms_test.py ...................... [ 6%] 158s test/core/parser/match_result_test.py ... [ 6%] 158s test/core/parser/parse_test.py ... [ 6%] 158s test/core/parser/parser_test.py ........... [ 6%] 158s test/core/parser/segments/segments_base_test.py ........................ [ 6%] 158s ... [ 6%] 158s test/core/parser/segments/segments_common_test.py . [ 6%] 158s test/core/parser/segments/segments_file_test.py . [ 6%] 158s test/core/parser/segments/segments_raw_test.py .. [ 6%] 159s test/core/rules/crawlers_test.py ... [ 7%] 159s test/core/rules/docstring_test.py ..... [ 7%] 159s test/core/rules/functional/raw_file_slices_test.py ...... [ 7%] 159s test/core/rules/functional/segments_test.py .................... [ 7%] 159s test/core/rules/noqa_test.py ........................................... [ 7%] 160s .... [ 7%] 160s test/core/rules/reference_test.py .............. [ 8%] 161s test/core/rules/rules_test.py ............................. [ 8%] 161s test/core/templaters/base_test.py ............................ [ 8%] 161s test/core/templaters/builtins_test.py .. [ 8%] 163s test/core/templaters/jinja_test.py ..................................... [ 9%] 166s ........................................................................ [ 10%] 166s ..... [ 10%] 167s test/core/templaters/placeholder_test.py ....................... [ 10%] 167s test/core/templaters/python_test.py .................................... [ 10%] 167s [ 10%] 168s test/dialects/ansi_test.py ............................................. [ 11%] 168s ........ [ 11%] 174s test/dialects/bigquery_test.py ...... [ 11%] 182s test/dialects/dialects_test.py ......................................... [ 11%] 192s ........................................................................ [ 12%] 203s ........................................................................ [ 13%] 207s ........................................................................ [ 14%] 211s ........................................................................ [ 15%] 218s ........................................................................ [ 16%] 225s ........................................................................ [ 17%] 235s ........................................................................ [ 17%] 245s ........................................................................ [ 18%] 252s ........................................................................ [ 19%] 256s ........................................................................ [ 20%] 261s ........................................................................ [ 21%] 269s ........................................................................ [ 22%] 277s ........................................................................ [ 22%] 289s ........................................................................ [ 23%] 294s ........................................................................ [ 24%] 299s ........................................................................ [ 25%] 306s ........................................................................ [ 26%] 317s ........................................................................ [ 27%] 326s ........................................................................ [ 28%] 344s ........................................................................ [ 28%] 359s ........................................................................ [ 29%] 374s ........................................................................ [ 30%] 386s ........................................................................ [ 31%] 400s ........................................................................ [ 32%] 420s ........................................................................ [ 33%] 452s ........................................................................ [ 33%] 499s ........................................................................ [ 34%] 510s ........................................................................ [ 35%] 520s ........................................................................ [ 36%] 535s ........................................................................ [ 37%] 553s ........................................................................ [ 38%] 579s ........................................................................ [ 39%] 600s ........................................................................ [ 39%] 611s ........................................................................ [ 40%] 623s ........................................................................ [ 41%] 635s ........................................................................ [ 42%] 663s ........................................................................ [ 43%] 686s ........................................................................ [ 44%] 736s ........................................................................ [ 44%] 745s ........................................................................ [ 45%] 757s ........................................................................ [ 46%] 778s ........................................................................ [ 47%] 817s ........................................................................ [ 48%] 847s ........................................................................ [ 49%] 901s ........................................................................ [ 50%] 948s ........................................................................ [ 50%] 987s ........................................................................ [ 51%] 1021s ........................................................................ [ 52%] 1047s ........................................................................ [ 53%] 1067s ........................................................................ [ 54%] 1077s ........................................................................ [ 55%] 1086s ........................................................................ [ 55%] 1089s ........................................................................ [ 56%] 1093s ........................................................................ [ 57%] 1097s ........................................................................ [ 58%] 1102s ........................................................................ [ 59%] 1112s ........................................................................ [ 60%] 1120s ........................................................................ [ 61%] 1124s ........................................................................ [ 61%] 1129s ........................................................................ [ 62%] 1133s ........................................................................ [ 63%] 1140s ........................................................................ [ 64%] 1146s ........................................................................ [ 65%] 1155s ........................................................................ [ 66%] 1159s ........................................................................ [ 66%] 1164s ........................................................................ [ 67%] 1168s ........................................................................ [ 68%] 1177s ........................................................................ [ 69%] 1185s ........................................................................ [ 70%] 1197s ........................................................................ [ 71%] 1210s ........................................................................ [ 71%] 1223s ........................................................................ [ 72%] 1233s ........................................................................ [ 73%] 1244s ........................................................................ [ 74%] 1251s .................................................... [ 75%] 1251s test/dialects/exasol_test.py ... [ 75%] 1251s test/dialects/postgres_test.py ..................... [ 75%] 1253s test/dialects/snowflake_test.py ............... [ 75%] 1253s test/dialects/soql_test.py ...... [ 75%] 1253s test/dialects/unparsable_test.py ... [ 75%] 1254s test/diff_quality_plugin_test.py FFFF [ 75%] 1255s test/rules/std_AL04_test.py ... [ 75%] 1258s test/rules/std_AL09_CP02_RF06_combo_test.py .......... [ 75%] 1258s test/rules/std_AM06_test.py ... [ 75%] 1258s test/rules/std_CV02_test.py . [ 75%] 1259s test/rules/std_CV09_test.py . [ 75%] 1259s test/rules/std_JJ01_test.py . [ 75%] 1259s test/rules/std_LT01_LT02_LT09_combo_test.py . [ 75%] 1259s test/rules/std_LT01_LT04_test.py . [ 75%] 1259s test/rules/std_LT01_ST02_test.py . [ 76%] 1259s test/rules/std_LT02_LT04_test.py . [ 76%] 1260s test/rules/std_LT02_LT11_combo_test.py .. [ 76%] 1260s test/rules/std_LT03_test.py ... [ 76%] 1260s test/rules/std_LT04_ST06_test.py ... [ 76%] 1261s test/rules/std_LT04_test.py . [ 76%] 1261s test/rules/std_LT05_LT09_combo_test.py ... [ 76%] 1261s test/rules/std_LT12_CV06_test.py . [ 76%] 1261s test/rules/std_RF01_LT09_test.py . [ 76%] 1261s test/rules/std_RF02_test.py . [ 76%] 1261s test/rules/std_ST03_test.py . [ 76%] 1262s test/rules/std_ST05_LT08_test.py . [ 76%] 1262s test/rules/std_ST05_LT09_test.py .. [ 76%] 1270s test/rules/std_fix_auto_test.py ........................................ [ 76%] 1274s .... [ 76%] 1276s test/rules/std_roundtrip_test.py ........ [ 76%] 1277s test/rules/std_test.py ......................... [ 77%] 1286s test/rules/yaml_test_cases_test.py ..................................... [ 77%] 1298s ........................................................................ [ 78%] 1310s ........................................................................ [ 79%] 1326s ........................................................................ [ 80%] 1337s ........................................................................ [ 80%] 1349s ........................................................................ [ 81%] 1363s ........................................................................ [ 82%] 1379s ........................................................................ [ 83%] 1394s ........................................................................ [ 84%] 1410s ........................................................................ [ 85%] 1420s ........................................................................ [ 86%] 1442s ........................................................................ [ 86%] 1459s ........................................................................ [ 87%] 1483s ........................................................................ [ 88%] 1509s ........................................................................ [ 89%] 1530s ........................................................................ [ 90%] 1546s ........................................................................ [ 91%] 1563s ........................................................................ [ 91%] 1579s ........................................................................ [ 92%] 1591s ........................................................................ [ 93%] 1602s ........................................................................ [ 94%] 1611s ........................................................................ [ 95%] 1624s ........................................................................ [ 96%] 1644s ........................................................................ [ 97%] 1665s ........................................................................ [ 97%] 1672s ............................................... [ 98%] 1672s test/testing_test.py ...... [ 98%] 1674s test/utils/analysis/query_test.py ................. [ 98%] 1674s test/utils/reflow/depthmap_test.py ... [ 98%] 1675s test/utils/reflow/rebreak_test.py ................ [ 98%] 1679s test/utils/reflow/reindent_test.py ..................................... [ 99%] 1681s ....................... [ 99%] 1682s test/utils/reflow/respace_test.py .................. [ 99%] 1684s test/utils/reflow/sequence_test.py ............... [100%] 1684s 1684s =================================== FAILURES =================================== 1684s _________________________ test__cli__command_directed __________________________ 1684s 1684s def test__cli__command_directed(): 1684s """Basic checking of lint functionality.""" 1684s > result = invoke_assert_code( 1684s ret_code=1, 1684s args=[ 1684s lint, 1684s [ 1684s "--disable-progress-bar", 1684s "test/fixtures/linter/indentation_error_simple.sql", 1684s ], 1684s ], 1684s ) 1684s 1684s test/cli/commands_test.py:89: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['--disable-progress-bar', 'test/fixtures/linter/indentation_error_simple.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s __________________________ test__cli__command_dialect __________________________ 1684s 1684s def test__cli__command_dialect(): 1684s """Check the script raises the right exception on an unknown dialect.""" 1684s # The dialect is unknown should be a non-zero exit code 1684s > invoke_assert_code( 1684s ret_code=2, 1684s args=[ 1684s lint, 1684s [ 1684s "-n", 1684s "--dialect", 1684s "faslkjh", 1684s "test/fixtures/linter/indentation_error_simple.sql", 1684s ], 1684s ], 1684s ) 1684s 1684s test/cli/commands_test.py:113: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 2 1684s args = [, ['-n', '--dialect', 'faslkjh', 'test/fixtures/linter/indentation_error_simple.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_no_dialect[command0] ____________________ 1684s 1684s command = 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s render, 1684s parse, 1684s lint, 1684s cli_format, 1684s fix, 1684s ], 1684s ) 1684s def test__cli__command_no_dialect(command): 1684s """Check the script raises the right exception no dialect.""" 1684s # The dialect is unknown should be a non-zero exit code 1684s > result = invoke_assert_code( 1684s ret_code=2, 1684s args=[ 1684s command, 1684s ["-"], 1684s ], 1684s cli_input="SELECT 1", 1684s ) 1684s 1684s test/cli/commands_test.py:140: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 2, args = [, ['-']], kwargs = {'input': 'SELECT 1'} 1684s cli_input = 'SELECT 1', mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_no_dialect[command1] ____________________ 1684s 1684s command = 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s render, 1684s parse, 1684s lint, 1684s cli_format, 1684s fix, 1684s ], 1684s ) 1684s def test__cli__command_no_dialect(command): 1684s """Check the script raises the right exception no dialect.""" 1684s # The dialect is unknown should be a non-zero exit code 1684s > result = invoke_assert_code( 1684s ret_code=2, 1684s args=[ 1684s command, 1684s ["-"], 1684s ], 1684s cli_input="SELECT 1", 1684s ) 1684s 1684s test/cli/commands_test.py:140: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 2, args = [, ['-']], kwargs = {'input': 'SELECT 1'} 1684s cli_input = 'SELECT 1', mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_no_dialect[command2] ____________________ 1684s 1684s command = 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s render, 1684s parse, 1684s lint, 1684s cli_format, 1684s fix, 1684s ], 1684s ) 1684s def test__cli__command_no_dialect(command): 1684s """Check the script raises the right exception no dialect.""" 1684s # The dialect is unknown should be a non-zero exit code 1684s > result = invoke_assert_code( 1684s ret_code=2, 1684s args=[ 1684s command, 1684s ["-"], 1684s ], 1684s cli_input="SELECT 1", 1684s ) 1684s 1684s test/cli/commands_test.py:140: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 2, args = [, ['-']], kwargs = {'input': 'SELECT 1'} 1684s cli_input = 'SELECT 1', mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_no_dialect[command3] ____________________ 1684s 1684s command = 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s render, 1684s parse, 1684s lint, 1684s cli_format, 1684s fix, 1684s ], 1684s ) 1684s def test__cli__command_no_dialect(command): 1684s """Check the script raises the right exception no dialect.""" 1684s # The dialect is unknown should be a non-zero exit code 1684s > result = invoke_assert_code( 1684s ret_code=2, 1684s args=[ 1684s command, 1684s ["-"], 1684s ], 1684s cli_input="SELECT 1", 1684s ) 1684s 1684s test/cli/commands_test.py:140: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 2, args = [, ['-']], kwargs = {'input': 'SELECT 1'} 1684s cli_input = 'SELECT 1', mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_no_dialect[command4] ____________________ 1684s 1684s command = 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s render, 1684s parse, 1684s lint, 1684s cli_format, 1684s fix, 1684s ], 1684s ) 1684s def test__cli__command_no_dialect(command): 1684s """Check the script raises the right exception no dialect.""" 1684s # The dialect is unknown should be a non-zero exit code 1684s > result = invoke_assert_code( 1684s ret_code=2, 1684s args=[ 1684s command, 1684s ["-"], 1684s ], 1684s cli_input="SELECT 1", 1684s ) 1684s 1684s test/cli/commands_test.py:140: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 2, args = [, ['-']], kwargs = {'input': 'SELECT 1'} 1684s cli_input = 'SELECT 1', mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________ test__cli__command_parse_error_dialect_explicit_warning ____________ 1684s 1684s def test__cli__command_parse_error_dialect_explicit_warning(): 1684s """Check parsing error raises the right warning.""" 1684s # For any parsing error there should be a non-zero exit code 1684s # and a human-readable warning should be displayed. 1684s # Dialect specified as commandline option. 1684s > invoke_assert_code( 1684s ret_code=1, 1684s args=[ 1684s parse, 1684s [ 1684s "-n", 1684s "--dialect", 1684s "postgres", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ], 1684s assert_output_contains=( 1684s "WARNING: Parsing errors found and dialect is set to 'postgres'. " 1684s "Have you configured your dialect correctly?" 1684s ), 1684s ) 1684s 1684s test/cli/commands_test.py:159: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['-n', '--dialect', 'postgres', 'test/fixtures/cli/fail_many.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True 1684s assert_output_contains = "WARNING: Parsing errors found and dialect is set to 'postgres'. Have you configured your dialect correctly?" 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________ test__cli__command_parse_error_dialect_implicit_warning ____________ 1684s 1684s def test__cli__command_parse_error_dialect_implicit_warning(): 1684s """Check parsing error raises the right warning.""" 1684s # For any parsing error there should be a non-zero exit code 1684s # and a human-readable warning should be displayed. 1684s # Dialect specified in .sqlfluff config. 1684s > invoke_assert_code( 1684s ret_code=1, 1684s args=[ 1684s # Config sets dialect to tsql 1684s parse, 1684s [ 1684s "-n", 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ], 1684s assert_output_contains=( 1684s "WARNING: Parsing errors found and dialect is set to 'tsql'. " 1684s "Have you configured your dialect correctly?" 1684s ), 1684s ) 1684s 1684s test/cli/commands_test.py:182: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['-n', '--config', 'test/fixtures/cli/extra_configs/.sqlfluff', 'test/fixtures/cli/fail_many.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True 1684s assert_output_contains = "WARNING: Parsing errors found and dialect is set to 'tsql'. Have you configured your dialect correctly?" 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ______________________ test__cli__command_dialect_legacy _______________________ 1684s 1684s def test__cli__command_dialect_legacy(): 1684s """Check the script raises the right exception on a legacy dialect.""" 1684s > invoke_assert_code( 1684s ret_code=2, 1684s args=[ 1684s lint, 1684s [ 1684s "-n", 1684s "--dialect", 1684s "exasol_fs", 1684s "test/fixtures/linter/indentation_error_simple.sql", 1684s ], 1684s ], 1684s assert_output_contains="Please use the 'exasol' dialect instead.", 1684s ) 1684s 1684s test/cli/commands_test.py:203: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 2 1684s args = [, ['-n', '--dialect', 'exasol_fs', 'test/fixtures/linter/indentation_error_simple.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True 1684s assert_output_contains = "Please use the 'exasol' dialect instead." 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _____________________ test__cli__command_extra_config_fail _____________________ 1684s 1684s def test__cli__command_extra_config_fail(): 1684s """Check the script raises the right exception non-existent extra config path.""" 1684s > invoke_assert_code( 1684s ret_code=2, 1684s args=[ 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluffsdfdfdfsfd", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ], 1684s assert_output_contains=( 1684s "Extra config path 'test/fixtures/cli/extra_configs/.sqlfluffsdfdfdfsfd' " 1684s "does not exist." 1684s ), 1684s ) 1684s 1684s test/cli/commands_test.py:220: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 2 1684s args = [, ['--config', 'test/fixtures/cli/extra_configs/.sqlfluffsdfdfdfsfd', 'test/fixtures/cli/extra_config_tsql.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True 1684s assert_output_contains = "Extra config path 'test/fixtures/cli/extra_configs/.sqlfluffsdfdfdfsfd' does not exist." 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ 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'] _ 1684s 1684s command = 1684s stdin_filepath = 'test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql' 1684s ret_code = 0 1684s output = "[L: 5, P: 1] | join_clause:\n[L: 5, P: 1] | keyword: 'POSITIONAL'" 1684s 1684s @pytest.mark.parametrize( 1684s ("command", "stdin_filepath", "ret_code", "output"), 1684s [ 1684s ( 1684s parse, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s ( 1684s "[L: 5, P: 1] | join_clause:\n" 1684s "[L: 5, P: 1] | keyword:" 1684s " 'POSITIONAL'" 1684s ), 1684s ), 1684s ( 1684s parse, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Parsing errors found and dialect is set to 'ansi'.", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s "All Finished!", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s "All Finished!", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Parsing errors found and dialect is set to 'ansi'.", 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "[1 templating/parsing errors found]", 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Unfixable violations detected.", 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_stdin_filename_config(command, stdin_filepath, ret_code, output): 1684s """Check the script picks up the config from the indicated path.""" 1684s > invoke_assert_code( 1684s ret_code=ret_code, 1684s args=[ 1684s command, 1684s [ 1684s "--stdin-filename", 1684s stdin_filepath, 1684s "-", 1684s ], 1684s ], 1684s cli_input=stdin_cli_input, 1684s assert_output_contains=output, 1684s ) 1684s 1684s test/cli/commands_test.py:319: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ['--stdin-filename', 'test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql', '-']] 1684s kwargs = {'input': 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n'} 1684s cli_input = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1684s mix_stderr = True 1684s assert_output_contains = "[L: 5, P: 1] | join_clause:\n[L: 5, P: 1] | keyword: 'POSITIONAL'" 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ test__cli__command_stdin_filename_config[command1-test/fixtures/an_ansi_config_here.sql-1-Parsing errors found and dialect is set to 'ansi'.] _ 1684s 1684s command = 1684s stdin_filepath = 'test/fixtures/an_ansi_config_here.sql', ret_code = 1 1684s output = "Parsing errors found and dialect is set to 'ansi'." 1684s 1684s @pytest.mark.parametrize( 1684s ("command", "stdin_filepath", "ret_code", "output"), 1684s [ 1684s ( 1684s parse, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s ( 1684s "[L: 5, P: 1] | join_clause:\n" 1684s "[L: 5, P: 1] | keyword:" 1684s " 'POSITIONAL'" 1684s ), 1684s ), 1684s ( 1684s parse, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Parsing errors found and dialect is set to 'ansi'.", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s "All Finished!", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s "All Finished!", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Parsing errors found and dialect is set to 'ansi'.", 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "[1 templating/parsing errors found]", 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Unfixable violations detected.", 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_stdin_filename_config(command, stdin_filepath, ret_code, output): 1684s """Check the script picks up the config from the indicated path.""" 1684s > invoke_assert_code( 1684s ret_code=ret_code, 1684s args=[ 1684s command, 1684s [ 1684s "--stdin-filename", 1684s stdin_filepath, 1684s "-", 1684s ], 1684s ], 1684s cli_input=stdin_cli_input, 1684s assert_output_contains=output, 1684s ) 1684s 1684s test/cli/commands_test.py:319: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['--stdin-filename', 'test/fixtures/an_ansi_config_here.sql', '-']] 1684s kwargs = {'input': 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n'} 1684s cli_input = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1684s mix_stderr = True 1684s assert_output_contains = "Parsing errors found and dialect is set to 'ansi'." 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ test__cli__command_stdin_filename_config[command2-test/fixtures/cli/stdin_filename/stdin_filename.sql-0-All Finished!] _ 1684s 1684s command = 1684s stdin_filepath = 'test/fixtures/cli/stdin_filename/stdin_filename.sql' 1684s ret_code = 0, output = 'All Finished!' 1684s 1684s @pytest.mark.parametrize( 1684s ("command", "stdin_filepath", "ret_code", "output"), 1684s [ 1684s ( 1684s parse, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s ( 1684s "[L: 5, P: 1] | join_clause:\n" 1684s "[L: 5, P: 1] | keyword:" 1684s " 'POSITIONAL'" 1684s ), 1684s ), 1684s ( 1684s parse, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Parsing errors found and dialect is set to 'ansi'.", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s "All Finished!", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s "All Finished!", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Parsing errors found and dialect is set to 'ansi'.", 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "[1 templating/parsing errors found]", 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Unfixable violations detected.", 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_stdin_filename_config(command, stdin_filepath, ret_code, output): 1684s """Check the script picks up the config from the indicated path.""" 1684s > invoke_assert_code( 1684s ret_code=ret_code, 1684s args=[ 1684s command, 1684s [ 1684s "--stdin-filename", 1684s stdin_filepath, 1684s "-", 1684s ], 1684s ], 1684s cli_input=stdin_cli_input, 1684s assert_output_contains=output, 1684s ) 1684s 1684s test/cli/commands_test.py:319: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ['--stdin-filename', 'test/fixtures/cli/stdin_filename/stdin_filename.sql', '-']] 1684s kwargs = {'input': 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n'} 1684s cli_input = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1684s mix_stderr = True, assert_output_contains = 'All Finished!' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ test__cli__command_stdin_filename_config[command3-test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql-0-All Finished!] _ 1684s 1684s command = 1684s stdin_filepath = 'test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql' 1684s ret_code = 0, output = 'All Finished!' 1684s 1684s @pytest.mark.parametrize( 1684s ("command", "stdin_filepath", "ret_code", "output"), 1684s [ 1684s ( 1684s parse, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s ( 1684s "[L: 5, P: 1] | join_clause:\n" 1684s "[L: 5, P: 1] | keyword:" 1684s " 'POSITIONAL'" 1684s ), 1684s ), 1684s ( 1684s parse, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Parsing errors found and dialect is set to 'ansi'.", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s "All Finished!", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s "All Finished!", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Parsing errors found and dialect is set to 'ansi'.", 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "[1 templating/parsing errors found]", 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Unfixable violations detected.", 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_stdin_filename_config(command, stdin_filepath, ret_code, output): 1684s """Check the script picks up the config from the indicated path.""" 1684s > invoke_assert_code( 1684s ret_code=ret_code, 1684s args=[ 1684s command, 1684s [ 1684s "--stdin-filename", 1684s stdin_filepath, 1684s "-", 1684s ], 1684s ], 1684s cli_input=stdin_cli_input, 1684s assert_output_contains=output, 1684s ) 1684s 1684s test/cli/commands_test.py:319: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ['--stdin-filename', 'test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql', '-']] 1684s kwargs = {'input': 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n'} 1684s cli_input = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1684s mix_stderr = True, assert_output_contains = 'All Finished!' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ test__cli__command_stdin_filename_config[command4-test/fixtures/an_ansi_config_here.sql-1-Parsing errors found and dialect is set to 'ansi'.] _ 1684s 1684s command = 1684s stdin_filepath = 'test/fixtures/an_ansi_config_here.sql', ret_code = 1 1684s output = "Parsing errors found and dialect is set to 'ansi'." 1684s 1684s @pytest.mark.parametrize( 1684s ("command", "stdin_filepath", "ret_code", "output"), 1684s [ 1684s ( 1684s parse, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s ( 1684s "[L: 5, P: 1] | join_clause:\n" 1684s "[L: 5, P: 1] | keyword:" 1684s " 'POSITIONAL'" 1684s ), 1684s ), 1684s ( 1684s parse, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Parsing errors found and dialect is set to 'ansi'.", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s "All Finished!", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s "All Finished!", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Parsing errors found and dialect is set to 'ansi'.", 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "[1 templating/parsing errors found]", 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Unfixable violations detected.", 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_stdin_filename_config(command, stdin_filepath, ret_code, output): 1684s """Check the script picks up the config from the indicated path.""" 1684s > invoke_assert_code( 1684s ret_code=ret_code, 1684s args=[ 1684s command, 1684s [ 1684s "--stdin-filename", 1684s stdin_filepath, 1684s "-", 1684s ], 1684s ], 1684s cli_input=stdin_cli_input, 1684s assert_output_contains=output, 1684s ) 1684s 1684s test/cli/commands_test.py:319: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['--stdin-filename', 'test/fixtures/an_ansi_config_here.sql', '-']] 1684s kwargs = {'input': 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n'} 1684s cli_input = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1684s mix_stderr = True 1684s assert_output_contains = "Parsing errors found and dialect is set to 'ansi'." 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ 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] _ 1684s 1684s command = 1684s stdin_filepath = 'test/fixtures/cli/stdin_filename/stdin_filename.sql' 1684s ret_code = 0 1684s output = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1684s 1684s @pytest.mark.parametrize( 1684s ("command", "stdin_filepath", "ret_code", "output"), 1684s [ 1684s ( 1684s parse, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s ( 1684s "[L: 5, P: 1] | join_clause:\n" 1684s "[L: 5, P: 1] | keyword:" 1684s " 'POSITIONAL'" 1684s ), 1684s ), 1684s ( 1684s parse, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Parsing errors found and dialect is set to 'ansi'.", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s "All Finished!", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s "All Finished!", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Parsing errors found and dialect is set to 'ansi'.", 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "[1 templating/parsing errors found]", 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Unfixable violations detected.", 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_stdin_filename_config(command, stdin_filepath, ret_code, output): 1684s """Check the script picks up the config from the indicated path.""" 1684s > invoke_assert_code( 1684s ret_code=ret_code, 1684s args=[ 1684s command, 1684s [ 1684s "--stdin-filename", 1684s stdin_filepath, 1684s "-", 1684s ], 1684s ], 1684s cli_input=stdin_cli_input, 1684s assert_output_contains=output, 1684s ) 1684s 1684s test/cli/commands_test.py:319: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ['--stdin-filename', 'test/fixtures/cli/stdin_filename/stdin_filename.sql', '-']] 1684s kwargs = {'input': 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n'} 1684s cli_input = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1684s mix_stderr = True 1684s assert_output_contains = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ 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] _ 1684s 1684s command = 1684s stdin_filepath = 'test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql' 1684s ret_code = 0 1684s output = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1684s 1684s @pytest.mark.parametrize( 1684s ("command", "stdin_filepath", "ret_code", "output"), 1684s [ 1684s ( 1684s parse, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s ( 1684s "[L: 5, P: 1] | join_clause:\n" 1684s "[L: 5, P: 1] | keyword:" 1684s " 'POSITIONAL'" 1684s ), 1684s ), 1684s ( 1684s parse, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Parsing errors found and dialect is set to 'ansi'.", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s "All Finished!", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s "All Finished!", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Parsing errors found and dialect is set to 'ansi'.", 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "[1 templating/parsing errors found]", 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Unfixable violations detected.", 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_stdin_filename_config(command, stdin_filepath, ret_code, output): 1684s """Check the script picks up the config from the indicated path.""" 1684s > invoke_assert_code( 1684s ret_code=ret_code, 1684s args=[ 1684s command, 1684s [ 1684s "--stdin-filename", 1684s stdin_filepath, 1684s "-", 1684s ], 1684s ], 1684s cli_input=stdin_cli_input, 1684s assert_output_contains=output, 1684s ) 1684s 1684s test/cli/commands_test.py:319: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ['--stdin-filename', 'test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql', '-']] 1684s kwargs = {'input': 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n'} 1684s cli_input = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1684s mix_stderr = True 1684s assert_output_contains = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ test__cli__command_stdin_filename_config[command7-test/fixtures/an_ansi_config_here.sql-1-[1 templating/parsing errors found]] _ 1684s 1684s command = 1684s stdin_filepath = 'test/fixtures/an_ansi_config_here.sql', ret_code = 1 1684s output = '[1 templating/parsing errors found]' 1684s 1684s @pytest.mark.parametrize( 1684s ("command", "stdin_filepath", "ret_code", "output"), 1684s [ 1684s ( 1684s parse, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s ( 1684s "[L: 5, P: 1] | join_clause:\n" 1684s "[L: 5, P: 1] | keyword:" 1684s " 'POSITIONAL'" 1684s ), 1684s ), 1684s ( 1684s parse, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Parsing errors found and dialect is set to 'ansi'.", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s "All Finished!", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s "All Finished!", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Parsing errors found and dialect is set to 'ansi'.", 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "[1 templating/parsing errors found]", 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Unfixable violations detected.", 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_stdin_filename_config(command, stdin_filepath, ret_code, output): 1684s """Check the script picks up the config from the indicated path.""" 1684s > invoke_assert_code( 1684s ret_code=ret_code, 1684s args=[ 1684s command, 1684s [ 1684s "--stdin-filename", 1684s stdin_filepath, 1684s "-", 1684s ], 1684s ], 1684s cli_input=stdin_cli_input, 1684s assert_output_contains=output, 1684s ) 1684s 1684s test/cli/commands_test.py:319: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['--stdin-filename', 'test/fixtures/an_ansi_config_here.sql', '-']] 1684s kwargs = {'input': 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n'} 1684s cli_input = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1684s mix_stderr = True 1684s assert_output_contains = '[1 templating/parsing errors found]' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ 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] _ 1684s 1684s command = 1684s stdin_filepath = 'test/fixtures/cli/stdin_filename/stdin_filename.sql' 1684s ret_code = 0 1684s output = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1684s 1684s @pytest.mark.parametrize( 1684s ("command", "stdin_filepath", "ret_code", "output"), 1684s [ 1684s ( 1684s parse, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s ( 1684s "[L: 5, P: 1] | join_clause:\n" 1684s "[L: 5, P: 1] | keyword:" 1684s " 'POSITIONAL'" 1684s ), 1684s ), 1684s ( 1684s parse, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Parsing errors found and dialect is set to 'ansi'.", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s "All Finished!", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s "All Finished!", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Parsing errors found and dialect is set to 'ansi'.", 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "[1 templating/parsing errors found]", 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Unfixable violations detected.", 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_stdin_filename_config(command, stdin_filepath, ret_code, output): 1684s """Check the script picks up the config from the indicated path.""" 1684s > invoke_assert_code( 1684s ret_code=ret_code, 1684s args=[ 1684s command, 1684s [ 1684s "--stdin-filename", 1684s stdin_filepath, 1684s "-", 1684s ], 1684s ], 1684s cli_input=stdin_cli_input, 1684s assert_output_contains=output, 1684s ) 1684s 1684s test/cli/commands_test.py:319: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ['--stdin-filename', 'test/fixtures/cli/stdin_filename/stdin_filename.sql', '-']] 1684s kwargs = {'input': 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n'} 1684s cli_input = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1684s mix_stderr = True 1684s assert_output_contains = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ 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] _ 1684s 1684s command = 1684s stdin_filepath = 'test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql' 1684s ret_code = 0 1684s output = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1684s 1684s @pytest.mark.parametrize( 1684s ("command", "stdin_filepath", "ret_code", "output"), 1684s [ 1684s ( 1684s parse, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s ( 1684s "[L: 5, P: 1] | join_clause:\n" 1684s "[L: 5, P: 1] | keyword:" 1684s " 'POSITIONAL'" 1684s ), 1684s ), 1684s ( 1684s parse, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Parsing errors found and dialect is set to 'ansi'.", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s "All Finished!", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s "All Finished!", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Parsing errors found and dialect is set to 'ansi'.", 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "[1 templating/parsing errors found]", 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Unfixable violations detected.", 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_stdin_filename_config(command, stdin_filepath, ret_code, output): 1684s """Check the script picks up the config from the indicated path.""" 1684s > invoke_assert_code( 1684s ret_code=ret_code, 1684s args=[ 1684s command, 1684s [ 1684s "--stdin-filename", 1684s stdin_filepath, 1684s "-", 1684s ], 1684s ], 1684s cli_input=stdin_cli_input, 1684s assert_output_contains=output, 1684s ) 1684s 1684s test/cli/commands_test.py:319: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ['--stdin-filename', 'test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql', '-']] 1684s kwargs = {'input': 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n'} 1684s cli_input = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1684s mix_stderr = True 1684s assert_output_contains = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ test__cli__command_stdin_filename_config[command10-test/fixtures/an_ansi_config_here.sql-1-Unfixable violations detected.] _ 1684s 1684s command = 1684s stdin_filepath = 'test/fixtures/an_ansi_config_here.sql', ret_code = 1 1684s output = 'Unfixable violations detected.' 1684s 1684s @pytest.mark.parametrize( 1684s ("command", "stdin_filepath", "ret_code", "output"), 1684s [ 1684s ( 1684s parse, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s ( 1684s "[L: 5, P: 1] | join_clause:\n" 1684s "[L: 5, P: 1] | keyword:" 1684s " 'POSITIONAL'" 1684s ), 1684s ), 1684s ( 1684s parse, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Parsing errors found and dialect is set to 'ansi'.", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s "All Finished!", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s "All Finished!", 1684s ), 1684s ( 1684s lint, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Parsing errors found and dialect is set to 'ansi'.", 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s cli_format, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "[1 templating/parsing errors found]", 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/cli/stdin_filename/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/cli/stdin_filename/without_config/stdin_filename.sql", 1684s 0, 1684s stdin_cli_input, 1684s ), 1684s ( 1684s fix, 1684s "test/fixtures/an_ansi_config_here.sql", 1684s 1, 1684s "Unfixable violations detected.", 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_stdin_filename_config(command, stdin_filepath, ret_code, output): 1684s """Check the script picks up the config from the indicated path.""" 1684s > invoke_assert_code( 1684s ret_code=ret_code, 1684s args=[ 1684s command, 1684s [ 1684s "--stdin-filename", 1684s stdin_filepath, 1684s "-", 1684s ], 1684s ], 1684s cli_input=stdin_cli_input, 1684s assert_output_contains=output, 1684s ) 1684s 1684s test/cli/commands_test.py:319: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['--stdin-filename', 'test/fixtures/an_ansi_config_here.sql', '-']] 1684s kwargs = {'input': 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n'} 1684s cli_input = 'SELECT\n A.COL1,\n B.COL2\nFROM TABA AS A\nPOSITIONAL JOIN TABB AS B;\n' 1684s mix_stderr = True, assert_output_contains = 'Unfixable violations detected.' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_stdin[command0] ____________________ 1684s 1684s command = ('-', '-n') 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s ( 1684s "-", 1684s "-n", 1684s ), 1684s ( 1684s "-", 1684s "-n", 1684s "-v", 1684s ), 1684s ( 1684s "-", 1684s "-n", 1684s "-vv", 1684s ), 1684s ( 1684s "-", 1684s "-vv", 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_stdin(command): 1684s """Check basic commands on a simple script using stdin. 1684s 1684s The subprocess command should exit without errors, as no issues should be found. 1684s """ 1684s with open("test/fixtures/cli/passing_a.sql") as test_file: 1684s sql = test_file.read() 1684s > invoke_assert_code(args=[lint, ("--dialect=ansi",) + command], cli_input=sql) 1684s 1684s test/cli/commands_test.py:364: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0, args = [, ('--dialect=ansi', '-', '-n')] 1684s kwargs = {'input': 'SELECT\n tbl.name,\n tbl.value\nFROM tbl\n'} 1684s cli_input = 'SELECT\n tbl.name,\n tbl.value\nFROM tbl\n' 1684s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_stdin[command1] ____________________ 1684s 1684s command = ('-', '-n', '-v') 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s ( 1684s "-", 1684s "-n", 1684s ), 1684s ( 1684s "-", 1684s "-n", 1684s "-v", 1684s ), 1684s ( 1684s "-", 1684s "-n", 1684s "-vv", 1684s ), 1684s ( 1684s "-", 1684s "-vv", 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_stdin(command): 1684s """Check basic commands on a simple script using stdin. 1684s 1684s The subprocess command should exit without errors, as no issues should be found. 1684s """ 1684s with open("test/fixtures/cli/passing_a.sql") as test_file: 1684s sql = test_file.read() 1684s > invoke_assert_code(args=[lint, ("--dialect=ansi",) + command], cli_input=sql) 1684s 1684s test/cli/commands_test.py:364: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0, args = [, ('--dialect=ansi', '-', '-n', '-v')] 1684s kwargs = {'input': 'SELECT\n tbl.name,\n tbl.value\nFROM tbl\n'} 1684s cli_input = 'SELECT\n tbl.name,\n tbl.value\nFROM tbl\n' 1684s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_stdin[command2] ____________________ 1684s 1684s command = ('-', '-n', '-vv') 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s ( 1684s "-", 1684s "-n", 1684s ), 1684s ( 1684s "-", 1684s "-n", 1684s "-v", 1684s ), 1684s ( 1684s "-", 1684s "-n", 1684s "-vv", 1684s ), 1684s ( 1684s "-", 1684s "-vv", 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_stdin(command): 1684s """Check basic commands on a simple script using stdin. 1684s 1684s The subprocess command should exit without errors, as no issues should be found. 1684s """ 1684s with open("test/fixtures/cli/passing_a.sql") as test_file: 1684s sql = test_file.read() 1684s > invoke_assert_code(args=[lint, ("--dialect=ansi",) + command], cli_input=sql) 1684s 1684s test/cli/commands_test.py:364: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0, args = [, ('--dialect=ansi', '-', '-n', '-vv')] 1684s kwargs = {'input': 'SELECT\n tbl.name,\n tbl.value\nFROM tbl\n'} 1684s cli_input = 'SELECT\n tbl.name,\n tbl.value\nFROM tbl\n' 1684s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_stdin[command3] ____________________ 1684s 1684s command = ('-', '-vv') 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s ( 1684s "-", 1684s "-n", 1684s ), 1684s ( 1684s "-", 1684s "-n", 1684s "-v", 1684s ), 1684s ( 1684s "-", 1684s "-n", 1684s "-vv", 1684s ), 1684s ( 1684s "-", 1684s "-vv", 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_stdin(command): 1684s """Check basic commands on a simple script using stdin. 1684s 1684s The subprocess command should exit without errors, as no issues should be found. 1684s """ 1684s with open("test/fixtures/cli/passing_a.sql") as test_file: 1684s sql = test_file.read() 1684s > invoke_assert_code(args=[lint, ("--dialect=ansi",) + command], cli_input=sql) 1684s 1684s test/cli/commands_test.py:364: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0, args = [, ('--dialect=ansi', '-', '-vv')] 1684s kwargs = {'input': 'SELECT\n tbl.name,\n tbl.value\nFROM tbl\n'} 1684s cli_input = 'SELECT\n tbl.name,\n tbl.value\nFROM tbl\n' 1684s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _____________________ test__cli__command_lint_empty_stdin ______________________ 1684s 1684s def test__cli__command_lint_empty_stdin(): 1684s """Check linting an empty file raises no exceptions. 1684s 1684s https://github.com/sqlfluff/sqlfluff/issues/4807 1684s """ 1684s > invoke_assert_code(args=[lint, ("-d", "ansi", "-")], cli_input="") 1684s 1684s test/cli/commands_test.py:372: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0, args = [, ('-d', 'ansi', '-')], kwargs = {} 1684s cli_input = '', mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _______________________ test__cli__command_render_stdin ________________________ 1684s 1684s def test__cli__command_render_stdin(): 1684s """Check render on a simple script using stdin.""" 1684s with open("test/fixtures/cli/passing_a.sql") as test_file: 1684s sql = test_file.read() 1684s 1684s > invoke_assert_code( 1684s args=[render, ("--dialect=ansi", "-")], 1684s cli_input=sql, 1684s # Check we get back out the same file we input. 1684s assert_output_contains=sql, 1684s ) 1684s 1684s test/cli/commands_test.py:380: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0, args = [, ('--dialect=ansi', '-')] 1684s kwargs = {'input': 'SELECT\n tbl.name,\n tbl.value\nFROM tbl\n'} 1684s cli_input = 'SELECT\n tbl.name,\n tbl.value\nFROM tbl\n' 1684s mix_stderr = True 1684s assert_output_contains = 'SELECT\n tbl.name,\n tbl.value\nFROM tbl\n' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command0] ____________________ 1684s 1684s command = (, ['-n', 'test/fixtures/cli/passing_b.sql', '--exclude-rules', 'AM05']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['-n', 'test/fixtures/cli/passing_b.sql', '--exclude-rules', 'AM05']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command1] ____________________ 1684s 1684s command = (, ['test/fixtures/cli/passing_b.sql']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0, args = (, ['test/fixtures/cli/passing_b.sql']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command2] ____________________ 1684s 1684s command = (, ['test/fixtures/cli/jinja_variants.sql']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['test/fixtures/cli/jinja_variants.sql']), kwargs = {} 1684s cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command3] ____________________ 1684s 1684s command = (, ['-n', 'test/fixtures/cli/passing_a.sql']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0, args = (, ['-n', 'test/fixtures/cli/passing_a.sql']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command4] ____________________ 1684s 1684s command = (, ['-n', '-v', 'test/fixtures/cli/passing_a.sql']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['-n', '-v', 'test/fixtures/cli/passing_a.sql']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command5] ____________________ 1684s 1684s command = (, ['-n', '-vvvv', 'test/fixtures/cli/passing_a.sql']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['-n', '-vvvv', 'test/fixtures/cli/passing_a.sql']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command6] ____________________ 1684s 1684s command = (, ['-vvvv', 'test/fixtures/cli/passing_a.sql']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['-vvvv', 'test/fixtures/cli/passing_a.sql']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command7] ____________________ 1684s 1684s command = (, ['-n', 'test/fixtures/cli/passing_b.sql', '-vvvvvvvvvvv', '--exclude-rules', 'AM05']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['-n', 'test/fixtures/cli/passing_b.sql', '-vvvvvvvvvvv', '--exclude-rules', 'AM05']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command8] ____________________ 1684s 1684s command = (, ['-n', 'test/fixtures/cli/passing_b.sql', '-vvv', '--logger', 'parser', '-e', ...]) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['-n', 'test/fixtures/cli/passing_b.sql', '-vvv', '--logger', 'parser', '-e', ...]) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command9] ____________________ 1684s 1684s command = (, ['-n', 'test/fixtures/cli/passing_b.sql', '--exclude-rules', 'AM05']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['-n', 'test/fixtures/cli/passing_b.sql', '--exclude-rules', 'AM05']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command10] ___________________ 1684s 1684s command = (, ['-n', 'test/fixtures/cli/passing_b.sql', '-vvvvvvvvvvv', '-e', 'AM05']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['-n', 'test/fixtures/cli/passing_b.sql', '-vvvvvvvvvvv', '-e', 'AM05']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command11] ___________________ 1684s 1684s command = (, ['-n', 'test/fixtures/cli/passing_b.sql', '-c']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['-n', 'test/fixtures/cli/passing_b.sql', '-c']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command12] ___________________ 1684s 1684s command = (, ['-n', 'test/fixtures/cli/passing_b.sql', '-c', '--format', 'yaml']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['-n', 'test/fixtures/cli/passing_b.sql', '-c', '--format', 'yaml']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command13] ___________________ 1684s 1684s command = (, ['-n', 'test/fixtures/cli/passing_b.sql', '--format', 'yaml']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['-n', 'test/fixtures/cli/passing_b.sql', '--format', 'yaml']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command14] ___________________ 1684s 1684s command = (, ['-n', 'test/fixtures/cli/passing_b.sql', '--format', 'none']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['-n', 'test/fixtures/cli/passing_b.sql', '--format', 'none']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command15] ___________________ 1684s 1684s command = (, ['test/fixtures/cli/jinja_variants.sql']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0, args = (, ['test/fixtures/cli/jinja_variants.sql']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command16] ___________________ 1684s 1684s command = (, ['-n', 'test/fixtures/cli/passing_timing.sql', '--bench']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['-n', 'test/fixtures/cli/passing_timing.sql', '--bench']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command17] ___________________ 1684s 1684s command = (, ['-n', 'test/fixtures/cli/passing_timing.sql', '--bench']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['-n', 'test/fixtures/cli/passing_timing.sql', '--bench']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command18] ___________________ 1684s 1684s command = (, ['-n', 'test/fixtures/cli/passing_timing.sql', '--bench']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['-n', 'test/fixtures/cli/passing_timing.sql', '--bench']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command19] ___________________ 1684s 1684s command = (, ['-n', '--rules', 'CP01', 'test/fixtures/linter/operator_errors.sql']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['-n', '--rules', 'CP01', 'test/fixtures/linter/operator_errors.sql']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command20] ___________________ 1684s 1684s command = (, ['-n', '--ignore', 'linting', '-p', '2', 'test/fixtures/linter/operator_errors.sql', ...]) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['-n', '--ignore', 'linting', '-p', '2', 'test/fixtures/linter/operator_errors.sql', ...]) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command21] ___________________ 1684s 1684s command = (, ['-n', '--rules', 'CP01,LT02', 'test/fixtures/linter/operator_errors.sql']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['-n', '--rules', 'CP01,LT02', 'test/fixtures/linter/operator_errors.sql']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command22] ___________________ 1684s 1684s command = (, ['-n', '--rules', 'CP01,LT01', '--exclude-rules', 'LT01,AL07', 'test/fixtures/linter/operator_errors.sql']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['-n', '--rules', 'CP01,LT01', '--exclude-rules', 'LT01,AL07', 'test/fixtures/linter/operator_errors.sql']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command23] ___________________ 1684s 1684s command = (, ['-n', '--exclude-rules', 'LT01,LT03,AL07', 'test/fixtures/linter/operator_errors.sql']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['-n', '--exclude-rules', 'LT01,LT03,AL07', 'test/fixtures/linter/operator_errors.sql']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command24] ___________________ 1684s 1684s command = (, ['-n', '--exclude-rules', 'LT02,LT12,AL07', '--ignore', 'parsing,lexing', 'test/fixtures/linter/parse_lex_error.sql']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['-n', '--exclude-rules', 'LT02,LT12,AL07', '--ignore', 'parsing,lexing', 'test/fixtures/linter/parse_lex_error.sql']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command25] ___________________ 1684s 1684s command = (, ['--nofail', 'test/fixtures/linter/parse_lex_error.sql']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['--nofail', 'test/fixtures/linter/parse_lex_error.sql']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command26] ___________________ 1684s 1684s command = (, ['--config', 'test/fixtures/cli/extra_configs/.sqlfluff', 'test/fixtures/cli/extra_config_tsql.sql']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['--config', 'test/fixtures/cli/extra_configs/.sqlfluff', 'test/fixtures/cli/extra_config_tsql.sql']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command27] ___________________ 1684s 1684s command = (, ['--config', 'test/fixtures/cli/extra_configs/pyproject.toml', 'test/fixtures/cli/extra_config_tsql.sql']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['--config', 'test/fixtures/cli/extra_configs/pyproject.toml', 'test/fixtures/cli/extra_config_tsql.sql']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command28] ___________________ 1684s 1684s command = (, ['test/fixtures/cli/passing_a.sql', '--persist-timing', 'test.csv']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['test/fixtures/cli/passing_a.sql', '--persist-timing', 'test.csv']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________ test__cli__command_lint_parse[command29] ___________________ 1684s 1684s command = (, ['--help']) 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s # Test basic linting 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Basic render 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/passing_b.sql", 1684s ], 1684s ), 1684s # Render with variants 1684s ( 1684s render, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Original tests from test__cli__command_lint 1684s (lint, ["-n", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-v", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-n", "-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s (lint, ["-vvvv", "test/fixtures/cli/passing_a.sql"]), 1684s # Test basic linting with very high verbosity 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic linting with specific logger. 1684s # Also test short rule exclusion. 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvv", 1684s "--logger", 1684s "parser", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "--exclude-rules", 1684s "AM05", 1684s ], 1684s ), 1684s # Test basic parsing with very high verbosity 1684s ( 1684s parse, 1684s [ 1684s "-n", 1684s "test/fixtures/cli/passing_b.sql", 1684s "-vvvvvvvvvvv", 1684s "-e", 1684s "AM05", 1684s ], 1684s ), 1684s # Check basic parsing, with the code only option 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c"]), 1684s # Check basic parsing, with the yaml output 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "-c", "--format", "yaml"]), 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "yaml"]), 1684s # Check parsing with no output (used mostly for testing) 1684s (parse, ["-n", "test/fixtures/cli/passing_b.sql", "--format", "none"]), 1684s # Parsing with variants 1684s ( 1684s parse, 1684s [ 1684s "test/fixtures/cli/jinja_variants.sql", 1684s ], 1684s ), 1684s # Check the benching commands 1684s (parse, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (lint, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s (fix, ["-n", "test/fixtures/cli/passing_timing.sql", "--bench"]), 1684s # Check linting works in specifying rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check ignoring linting (multiprocess) 1684s # https://github.com/sqlfluff/sqlfluff/issues/5066 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--ignore", 1684s "linting", 1684s "-p", 1684s "2", 1684s "test/fixtures/linter/operator_errors.sql", 1684s "test/fixtures/linter/comma_errors.sql", 1684s ], 1684s ), 1684s # Check linting works in specifying multiple rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT02", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with both included and excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--rules", 1684s "CP01,LT01", 1684s "--exclude-rules", 1684s "LT01,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check linting works with just excluded rules 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT01,LT03,AL07", 1684s "test/fixtures/linter/operator_errors.sql", 1684s ], 1684s ), 1684s # Check that ignoring works (also checks that unicode files parse). 1684s ( 1684s lint, 1684s [ 1684s "-n", 1684s "--exclude-rules", 1684s "LT02,LT12,AL07", 1684s "--ignore", 1684s "parsing,lexing", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ), 1684s # Check nofail works 1684s (lint, ["--nofail", "test/fixtures/linter/parse_lex_error.sql"]), 1684s # Check config works (sets dialect to tsql) 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/.sqlfluff", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s ( 1684s lint, 1684s [ 1684s "--config", 1684s "test/fixtures/cli/extra_configs/pyproject.toml", 1684s "test/fixtures/cli/extra_config_tsql.sql", 1684s ], 1684s ), 1684s # Check timing outputs doesn't raise exceptions 1684s (lint, ["test/fixtures/cli/passing_a.sql", "--persist-timing", "test.csv"]), 1684s # Check lint --help command doesn't raise exception. 1684s # NOTE: This tests the LazySequence in action. 1684s (lint, ["--help"]), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse(command): 1684s """Check basic commands on a more complicated script.""" 1684s > invoke_assert_code(args=command) 1684s 1684s test/cli/commands_test.py:580: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0, args = (, ['--help']), kwargs = {}, cli_input = None 1684s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ____________ test__cli__command_lint_parse_with_retcode[command0-1] ____________ 1684s 1684s command = (, ['--rules', 'LT01', 'test/fixtures/cli/fail_many.sql', '-vvvvvvv']) 1684s ret_code = 1 1684s 1684s @pytest.mark.parametrize( 1684s "command, ret_code", 1684s [ 1684s # Check the script doesn't raise an unexpected exception with badly formed 1684s # files. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "test/fixtures/cli/fail_many.sql", 1684s "-vvvvvvv", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix with a suffixs 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix without specifying rules 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Format 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format with --persist-timing 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s "--persist-timing", 1684s "test.csv", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format (specifying rules) 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Template syntax error in macro file 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test overriding library path when it doesn't cause an issue 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1684s ), 1684s 0, 1684s ), 1684s # Test overriding library path when it DOES cause an issue 1684s # (because macros won't be found). 1684s ( 1684s ( 1684s # Render because that's the step where the issue will 1684s # occur. 1684s render, 1684s [ 1684s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1684s "--library-path", 1684s "none", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test render fail 1684s ( 1684s ( 1684s render, 1684s ["test/fixtures/cli/fail_many.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test a longer lint fail with --bench 1684s # This tests the threshold rules clause 1684s ( 1684s ( 1684s lint, 1684s [ 1684s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1684s "--bench", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test that setting --quiet with --verbose raises an error. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--quiet", 1684s "--verbose", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Test machine format parse command with an unparsable file. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s # Test machine format parse command with a fatal templating error. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1684s """Check commands expecting a non-zero ret code.""" 1684s > invoke_assert_code(ret_code=ret_code, args=command) 1684s 1684s test/cli/commands_test.py:749: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = (, ['--rules', 'LT01', 'test/fixtures/cli/fail_many.sql', '-vvvvvvv']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ____________ test__cli__command_lint_parse_with_retcode[command1-1] ____________ 1684s 1684s command = (, ['--rules', 'LT01', '--fixed-suffix', '_fix', 'test/fixtures/cli/fail_many.sql']) 1684s ret_code = 1 1684s 1684s @pytest.mark.parametrize( 1684s "command, ret_code", 1684s [ 1684s # Check the script doesn't raise an unexpected exception with badly formed 1684s # files. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "test/fixtures/cli/fail_many.sql", 1684s "-vvvvvvv", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix with a suffixs 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix without specifying rules 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Format 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format with --persist-timing 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s "--persist-timing", 1684s "test.csv", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format (specifying rules) 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Template syntax error in macro file 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test overriding library path when it doesn't cause an issue 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1684s ), 1684s 0, 1684s ), 1684s # Test overriding library path when it DOES cause an issue 1684s # (because macros won't be found). 1684s ( 1684s ( 1684s # Render because that's the step where the issue will 1684s # occur. 1684s render, 1684s [ 1684s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1684s "--library-path", 1684s "none", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test render fail 1684s ( 1684s ( 1684s render, 1684s ["test/fixtures/cli/fail_many.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test a longer lint fail with --bench 1684s # This tests the threshold rules clause 1684s ( 1684s ( 1684s lint, 1684s [ 1684s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1684s "--bench", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test that setting --quiet with --verbose raises an error. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--quiet", 1684s "--verbose", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Test machine format parse command with an unparsable file. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s # Test machine format parse command with a fatal templating error. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1684s """Check commands expecting a non-zero ret code.""" 1684s > invoke_assert_code(ret_code=ret_code, args=command) 1684s 1684s test/cli/commands_test.py:749: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = (, ['--rules', 'LT01', '--fixed-suffix', '_fix', 'test/fixtures/cli/fail_many.sql']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ____________ test__cli__command_lint_parse_with_retcode[command2-1] ____________ 1684s 1684s command = (, ['--fixed-suffix', '_fix', 'test/fixtures/cli/fail_many.sql']) 1684s ret_code = 1 1684s 1684s @pytest.mark.parametrize( 1684s "command, ret_code", 1684s [ 1684s # Check the script doesn't raise an unexpected exception with badly formed 1684s # files. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "test/fixtures/cli/fail_many.sql", 1684s "-vvvvvvv", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix with a suffixs 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix without specifying rules 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Format 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format with --persist-timing 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s "--persist-timing", 1684s "test.csv", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format (specifying rules) 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Template syntax error in macro file 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test overriding library path when it doesn't cause an issue 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1684s ), 1684s 0, 1684s ), 1684s # Test overriding library path when it DOES cause an issue 1684s # (because macros won't be found). 1684s ( 1684s ( 1684s # Render because that's the step where the issue will 1684s # occur. 1684s render, 1684s [ 1684s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1684s "--library-path", 1684s "none", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test render fail 1684s ( 1684s ( 1684s render, 1684s ["test/fixtures/cli/fail_many.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test a longer lint fail with --bench 1684s # This tests the threshold rules clause 1684s ( 1684s ( 1684s lint, 1684s [ 1684s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1684s "--bench", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test that setting --quiet with --verbose raises an error. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--quiet", 1684s "--verbose", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Test machine format parse command with an unparsable file. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s # Test machine format parse command with a fatal templating error. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1684s """Check commands expecting a non-zero ret code.""" 1684s > invoke_assert_code(ret_code=ret_code, args=command) 1684s 1684s test/cli/commands_test.py:749: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = (, ['--fixed-suffix', '_fix', 'test/fixtures/cli/fail_many.sql']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ____________ test__cli__command_lint_parse_with_retcode[command3-0] ____________ 1684s 1684s command = (, ['--fixed-suffix', '_fix', 'test/fixtures/linter/whitespace_errors.sql']) 1684s ret_code = 0 1684s 1684s @pytest.mark.parametrize( 1684s "command, ret_code", 1684s [ 1684s # Check the script doesn't raise an unexpected exception with badly formed 1684s # files. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "test/fixtures/cli/fail_many.sql", 1684s "-vvvvvvv", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix with a suffixs 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix without specifying rules 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Format 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format with --persist-timing 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s "--persist-timing", 1684s "test.csv", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format (specifying rules) 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Template syntax error in macro file 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test overriding library path when it doesn't cause an issue 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1684s ), 1684s 0, 1684s ), 1684s # Test overriding library path when it DOES cause an issue 1684s # (because macros won't be found). 1684s ( 1684s ( 1684s # Render because that's the step where the issue will 1684s # occur. 1684s render, 1684s [ 1684s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1684s "--library-path", 1684s "none", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test render fail 1684s ( 1684s ( 1684s render, 1684s ["test/fixtures/cli/fail_many.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test a longer lint fail with --bench 1684s # This tests the threshold rules clause 1684s ( 1684s ( 1684s lint, 1684s [ 1684s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1684s "--bench", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test that setting --quiet with --verbose raises an error. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--quiet", 1684s "--verbose", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Test machine format parse command with an unparsable file. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s # Test machine format parse command with a fatal templating error. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1684s """Check commands expecting a non-zero ret code.""" 1684s > invoke_assert_code(ret_code=ret_code, args=command) 1684s 1684s test/cli/commands_test.py:749: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['--fixed-suffix', '_fix', 'test/fixtures/linter/whitespace_errors.sql']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ____________ test__cli__command_lint_parse_with_retcode[command4-0] ____________ 1684s 1684s command = (, ['--fixed-suffix', '_fix', 'test/fixtures/linter/whitespace_errors.sql', '--persist-timing', 'test.csv']) 1684s ret_code = 0 1684s 1684s @pytest.mark.parametrize( 1684s "command, ret_code", 1684s [ 1684s # Check the script doesn't raise an unexpected exception with badly formed 1684s # files. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "test/fixtures/cli/fail_many.sql", 1684s "-vvvvvvv", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix with a suffixs 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix without specifying rules 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Format 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format with --persist-timing 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s "--persist-timing", 1684s "test.csv", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format (specifying rules) 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Template syntax error in macro file 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test overriding library path when it doesn't cause an issue 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1684s ), 1684s 0, 1684s ), 1684s # Test overriding library path when it DOES cause an issue 1684s # (because macros won't be found). 1684s ( 1684s ( 1684s # Render because that's the step where the issue will 1684s # occur. 1684s render, 1684s [ 1684s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1684s "--library-path", 1684s "none", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test render fail 1684s ( 1684s ( 1684s render, 1684s ["test/fixtures/cli/fail_many.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test a longer lint fail with --bench 1684s # This tests the threshold rules clause 1684s ( 1684s ( 1684s lint, 1684s [ 1684s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1684s "--bench", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test that setting --quiet with --verbose raises an error. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--quiet", 1684s "--verbose", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Test machine format parse command with an unparsable file. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s # Test machine format parse command with a fatal templating error. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1684s """Check commands expecting a non-zero ret code.""" 1684s > invoke_assert_code(ret_code=ret_code, args=command) 1684s 1684s test/cli/commands_test.py:749: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['--fixed-suffix', '_fix', 'test/fixtures/linter/whitespace_errors.sql', '--persist-timing', 'test.csv']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ____________ test__cli__command_lint_parse_with_retcode[command5-2] ____________ 1684s 1684s command = (, ['--rules', 'LT01', '--fixed-suffix', '_fix', 'test/fixtures/linter/whitespace_errors.sql']) 1684s ret_code = 2 1684s 1684s @pytest.mark.parametrize( 1684s "command, ret_code", 1684s [ 1684s # Check the script doesn't raise an unexpected exception with badly formed 1684s # files. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "test/fixtures/cli/fail_many.sql", 1684s "-vvvvvvv", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix with a suffixs 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix without specifying rules 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Format 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format with --persist-timing 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s "--persist-timing", 1684s "test.csv", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format (specifying rules) 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Template syntax error in macro file 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test overriding library path when it doesn't cause an issue 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1684s ), 1684s 0, 1684s ), 1684s # Test overriding library path when it DOES cause an issue 1684s # (because macros won't be found). 1684s ( 1684s ( 1684s # Render because that's the step where the issue will 1684s # occur. 1684s render, 1684s [ 1684s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1684s "--library-path", 1684s "none", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test render fail 1684s ( 1684s ( 1684s render, 1684s ["test/fixtures/cli/fail_many.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test a longer lint fail with --bench 1684s # This tests the threshold rules clause 1684s ( 1684s ( 1684s lint, 1684s [ 1684s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1684s "--bench", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test that setting --quiet with --verbose raises an error. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--quiet", 1684s "--verbose", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Test machine format parse command with an unparsable file. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s # Test machine format parse command with a fatal templating error. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1684s """Check commands expecting a non-zero ret code.""" 1684s > invoke_assert_code(ret_code=ret_code, args=command) 1684s 1684s test/cli/commands_test.py:749: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 2 1684s args = (, ['--rules', 'LT01', '--fixed-suffix', '_fix', 'test/fixtures/linter/whitespace_errors.sql']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ____________ test__cli__command_lint_parse_with_retcode[command6-1] ____________ 1684s 1684s command = (, ['test/fixtures/cli/unknown_jinja_tag/test.sql']) 1684s ret_code = 1 1684s 1684s @pytest.mark.parametrize( 1684s "command, ret_code", 1684s [ 1684s # Check the script doesn't raise an unexpected exception with badly formed 1684s # files. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "test/fixtures/cli/fail_many.sql", 1684s "-vvvvvvv", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix with a suffixs 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix without specifying rules 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Format 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format with --persist-timing 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s "--persist-timing", 1684s "test.csv", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format (specifying rules) 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Template syntax error in macro file 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test overriding library path when it doesn't cause an issue 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1684s ), 1684s 0, 1684s ), 1684s # Test overriding library path when it DOES cause an issue 1684s # (because macros won't be found). 1684s ( 1684s ( 1684s # Render because that's the step where the issue will 1684s # occur. 1684s render, 1684s [ 1684s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1684s "--library-path", 1684s "none", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test render fail 1684s ( 1684s ( 1684s render, 1684s ["test/fixtures/cli/fail_many.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test a longer lint fail with --bench 1684s # This tests the threshold rules clause 1684s ( 1684s ( 1684s lint, 1684s [ 1684s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1684s "--bench", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test that setting --quiet with --verbose raises an error. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--quiet", 1684s "--verbose", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Test machine format parse command with an unparsable file. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s # Test machine format parse command with a fatal templating error. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1684s """Check commands expecting a non-zero ret code.""" 1684s > invoke_assert_code(ret_code=ret_code, args=command) 1684s 1684s test/cli/commands_test.py:749: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = (, ['test/fixtures/cli/unknown_jinja_tag/test.sql']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ____________ test__cli__command_lint_parse_with_retcode[command7-0] ____________ 1684s 1684s command = (, ['test/fixtures/cli/passing_a.sql', '--library-path', 'none']) 1684s ret_code = 0 1684s 1684s @pytest.mark.parametrize( 1684s "command, ret_code", 1684s [ 1684s # Check the script doesn't raise an unexpected exception with badly formed 1684s # files. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "test/fixtures/cli/fail_many.sql", 1684s "-vvvvvvv", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix with a suffixs 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix without specifying rules 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Format 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format with --persist-timing 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s "--persist-timing", 1684s "test.csv", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format (specifying rules) 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Template syntax error in macro file 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test overriding library path when it doesn't cause an issue 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1684s ), 1684s 0, 1684s ), 1684s # Test overriding library path when it DOES cause an issue 1684s # (because macros won't be found). 1684s ( 1684s ( 1684s # Render because that's the step where the issue will 1684s # occur. 1684s render, 1684s [ 1684s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1684s "--library-path", 1684s "none", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test render fail 1684s ( 1684s ( 1684s render, 1684s ["test/fixtures/cli/fail_many.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test a longer lint fail with --bench 1684s # This tests the threshold rules clause 1684s ( 1684s ( 1684s lint, 1684s [ 1684s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1684s "--bench", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test that setting --quiet with --verbose raises an error. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--quiet", 1684s "--verbose", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Test machine format parse command with an unparsable file. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s # Test machine format parse command with a fatal templating error. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1684s """Check commands expecting a non-zero ret code.""" 1684s > invoke_assert_code(ret_code=ret_code, args=command) 1684s 1684s test/cli/commands_test.py:749: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = (, ['test/fixtures/cli/passing_a.sql', '--library-path', 'none']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ____________ test__cli__command_lint_parse_with_retcode[command8-1] ____________ 1684s 1684s command = (, ['test/fixtures/templater/jinja_r_library_in_macro/jinja.sql', '--library-path', 'none']) 1684s ret_code = 1 1684s 1684s @pytest.mark.parametrize( 1684s "command, ret_code", 1684s [ 1684s # Check the script doesn't raise an unexpected exception with badly formed 1684s # files. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "test/fixtures/cli/fail_many.sql", 1684s "-vvvvvvv", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix with a suffixs 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix without specifying rules 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Format 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format with --persist-timing 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s "--persist-timing", 1684s "test.csv", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format (specifying rules) 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Template syntax error in macro file 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test overriding library path when it doesn't cause an issue 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1684s ), 1684s 0, 1684s ), 1684s # Test overriding library path when it DOES cause an issue 1684s # (because macros won't be found). 1684s ( 1684s ( 1684s # Render because that's the step where the issue will 1684s # occur. 1684s render, 1684s [ 1684s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1684s "--library-path", 1684s "none", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test render fail 1684s ( 1684s ( 1684s render, 1684s ["test/fixtures/cli/fail_many.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test a longer lint fail with --bench 1684s # This tests the threshold rules clause 1684s ( 1684s ( 1684s lint, 1684s [ 1684s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1684s "--bench", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test that setting --quiet with --verbose raises an error. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--quiet", 1684s "--verbose", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Test machine format parse command with an unparsable file. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s # Test machine format parse command with a fatal templating error. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1684s """Check commands expecting a non-zero ret code.""" 1684s > invoke_assert_code(ret_code=ret_code, args=command) 1684s 1684s test/cli/commands_test.py:749: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = (, ['test/fixtures/templater/jinja_r_library_in_macro/jinja.sql', '--library-path', 'none']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ____________ test__cli__command_lint_parse_with_retcode[command9-1] ____________ 1684s 1684s command = (, ['test/fixtures/cli/fail_many.sql']), ret_code = 1 1684s 1684s @pytest.mark.parametrize( 1684s "command, ret_code", 1684s [ 1684s # Check the script doesn't raise an unexpected exception with badly formed 1684s # files. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "test/fixtures/cli/fail_many.sql", 1684s "-vvvvvvv", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix with a suffixs 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix without specifying rules 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Format 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format with --persist-timing 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s "--persist-timing", 1684s "test.csv", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format (specifying rules) 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Template syntax error in macro file 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test overriding library path when it doesn't cause an issue 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1684s ), 1684s 0, 1684s ), 1684s # Test overriding library path when it DOES cause an issue 1684s # (because macros won't be found). 1684s ( 1684s ( 1684s # Render because that's the step where the issue will 1684s # occur. 1684s render, 1684s [ 1684s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1684s "--library-path", 1684s "none", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test render fail 1684s ( 1684s ( 1684s render, 1684s ["test/fixtures/cli/fail_many.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test a longer lint fail with --bench 1684s # This tests the threshold rules clause 1684s ( 1684s ( 1684s lint, 1684s [ 1684s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1684s "--bench", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test that setting --quiet with --verbose raises an error. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--quiet", 1684s "--verbose", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Test machine format parse command with an unparsable file. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s # Test machine format parse command with a fatal templating error. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1684s """Check commands expecting a non-zero ret code.""" 1684s > invoke_assert_code(ret_code=ret_code, args=command) 1684s 1684s test/cli/commands_test.py:749: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1, args = (, ['test/fixtures/cli/fail_many.sql']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________ test__cli__command_lint_parse_with_retcode[command10-1] ____________ 1684s 1684s command = (, ['test/fixtures/linter/autofix/bigquery/004_templating/before.sql', '--bench']) 1684s ret_code = 1 1684s 1684s @pytest.mark.parametrize( 1684s "command, ret_code", 1684s [ 1684s # Check the script doesn't raise an unexpected exception with badly formed 1684s # files. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "test/fixtures/cli/fail_many.sql", 1684s "-vvvvvvv", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix with a suffixs 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix without specifying rules 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Format 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format with --persist-timing 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s "--persist-timing", 1684s "test.csv", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format (specifying rules) 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Template syntax error in macro file 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test overriding library path when it doesn't cause an issue 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1684s ), 1684s 0, 1684s ), 1684s # Test overriding library path when it DOES cause an issue 1684s # (because macros won't be found). 1684s ( 1684s ( 1684s # Render because that's the step where the issue will 1684s # occur. 1684s render, 1684s [ 1684s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1684s "--library-path", 1684s "none", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test render fail 1684s ( 1684s ( 1684s render, 1684s ["test/fixtures/cli/fail_many.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test a longer lint fail with --bench 1684s # This tests the threshold rules clause 1684s ( 1684s ( 1684s lint, 1684s [ 1684s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1684s "--bench", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test that setting --quiet with --verbose raises an error. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--quiet", 1684s "--verbose", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Test machine format parse command with an unparsable file. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s # Test machine format parse command with a fatal templating error. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1684s """Check commands expecting a non-zero ret code.""" 1684s > invoke_assert_code(ret_code=ret_code, args=command) 1684s 1684s test/cli/commands_test.py:749: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = (, ['test/fixtures/linter/autofix/bigquery/004_templating/before.sql', '--bench']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________ test__cli__command_lint_parse_with_retcode[command11-2] ____________ 1684s 1684s command = (, ['--quiet', '--verbose', 'test/fixtures/cli/fail_many.sql']) 1684s ret_code = 2 1684s 1684s @pytest.mark.parametrize( 1684s "command, ret_code", 1684s [ 1684s # Check the script doesn't raise an unexpected exception with badly formed 1684s # files. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "test/fixtures/cli/fail_many.sql", 1684s "-vvvvvvv", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix with a suffixs 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix without specifying rules 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Format 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format with --persist-timing 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s "--persist-timing", 1684s "test.csv", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format (specifying rules) 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Template syntax error in macro file 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test overriding library path when it doesn't cause an issue 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1684s ), 1684s 0, 1684s ), 1684s # Test overriding library path when it DOES cause an issue 1684s # (because macros won't be found). 1684s ( 1684s ( 1684s # Render because that's the step where the issue will 1684s # occur. 1684s render, 1684s [ 1684s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1684s "--library-path", 1684s "none", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test render fail 1684s ( 1684s ( 1684s render, 1684s ["test/fixtures/cli/fail_many.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test a longer lint fail with --bench 1684s # This tests the threshold rules clause 1684s ( 1684s ( 1684s lint, 1684s [ 1684s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1684s "--bench", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test that setting --quiet with --verbose raises an error. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--quiet", 1684s "--verbose", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Test machine format parse command with an unparsable file. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s # Test machine format parse command with a fatal templating error. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1684s """Check commands expecting a non-zero ret code.""" 1684s > invoke_assert_code(ret_code=ret_code, args=command) 1684s 1684s test/cli/commands_test.py:749: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 2 1684s args = (, ['--quiet', '--verbose', 'test/fixtures/cli/fail_many.sql']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________ test__cli__command_lint_parse_with_retcode[command12-1] ____________ 1684s 1684s command = (, ['test/fixtures/linter/parse_lex_error.sql', '-f', 'yaml']) 1684s ret_code = 1 1684s 1684s @pytest.mark.parametrize( 1684s "command, ret_code", 1684s [ 1684s # Check the script doesn't raise an unexpected exception with badly formed 1684s # files. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "test/fixtures/cli/fail_many.sql", 1684s "-vvvvvvv", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix with a suffixs 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix without specifying rules 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Format 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format with --persist-timing 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s "--persist-timing", 1684s "test.csv", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format (specifying rules) 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Template syntax error in macro file 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test overriding library path when it doesn't cause an issue 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1684s ), 1684s 0, 1684s ), 1684s # Test overriding library path when it DOES cause an issue 1684s # (because macros won't be found). 1684s ( 1684s ( 1684s # Render because that's the step where the issue will 1684s # occur. 1684s render, 1684s [ 1684s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1684s "--library-path", 1684s "none", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test render fail 1684s ( 1684s ( 1684s render, 1684s ["test/fixtures/cli/fail_many.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test a longer lint fail with --bench 1684s # This tests the threshold rules clause 1684s ( 1684s ( 1684s lint, 1684s [ 1684s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1684s "--bench", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test that setting --quiet with --verbose raises an error. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--quiet", 1684s "--verbose", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Test machine format parse command with an unparsable file. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s # Test machine format parse command with a fatal templating error. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1684s """Check commands expecting a non-zero ret code.""" 1684s > invoke_assert_code(ret_code=ret_code, args=command) 1684s 1684s test/cli/commands_test.py:749: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = (, ['test/fixtures/linter/parse_lex_error.sql', '-f', 'yaml']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________ test__cli__command_lint_parse_with_retcode[command13-1] ____________ 1684s 1684s command = (, ['test/fixtures/cli/jinja_fatal_fail.sql', '-f', 'yaml']) 1684s ret_code = 1 1684s 1684s @pytest.mark.parametrize( 1684s "command, ret_code", 1684s [ 1684s # Check the script doesn't raise an unexpected exception with badly formed 1684s # files. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "test/fixtures/cli/fail_many.sql", 1684s "-vvvvvvv", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix with a suffixs 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Fix without specifying rules 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Format 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format with --persist-timing 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s "--persist-timing", 1684s "test.csv", 1684s ], 1684s ), 1684s 0, 1684s ), 1684s # Format (specifying rules) 1684s ( 1684s ( 1684s cli_format, 1684s [ 1684s "--rules", 1684s "LT01", 1684s "--fixed-suffix", 1684s "_fix", 1684s "test/fixtures/linter/whitespace_errors.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Template syntax error in macro file 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/unknown_jinja_tag/test.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test overriding library path when it doesn't cause an issue 1684s ( 1684s ( 1684s lint, 1684s ["test/fixtures/cli/passing_a.sql", "--library-path", "none"], 1684s ), 1684s 0, 1684s ), 1684s # Test overriding library path when it DOES cause an issue 1684s # (because macros won't be found). 1684s ( 1684s ( 1684s # Render because that's the step where the issue will 1684s # occur. 1684s render, 1684s [ 1684s "test/fixtures/templater/jinja_r_library_in_macro/jinja.sql", 1684s "--library-path", 1684s "none", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test render fail 1684s ( 1684s ( 1684s render, 1684s ["test/fixtures/cli/fail_many.sql"], 1684s ), 1684s 1, 1684s ), 1684s # Test a longer lint fail with --bench 1684s # This tests the threshold rules clause 1684s ( 1684s ( 1684s lint, 1684s [ 1684s "test/fixtures/linter/autofix/bigquery/004_templating/before.sql", 1684s "--bench", 1684s ], 1684s ), 1684s 1, 1684s ), 1684s # Test that setting --quiet with --verbose raises an error. 1684s ( 1684s ( 1684s fix, 1684s [ 1684s "--quiet", 1684s "--verbose", 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ), 1684s 2, 1684s ), 1684s # Test machine format parse command with an unparsable file. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/linter/parse_lex_error.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s # Test machine format parse command with a fatal templating error. 1684s ( 1684s ( 1684s parse, 1684s ["test/fixtures/cli/jinja_fatal_fail.sql", "-f", "yaml"], 1684s ), 1684s 1, 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_parse_with_retcode(command, ret_code): 1684s """Check commands expecting a non-zero ret code.""" 1684s > invoke_assert_code(ret_code=ret_code, args=command) 1684s 1684s test/cli/commands_test.py:749: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = (, ['test/fixtures/cli/jinja_fatal_fail.sql', '-f', 'yaml']) 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________________________ test__cli__command_rules ___________________________ 1684s 1684s def test__cli__command_rules(): 1684s """Check rules command for exceptions.""" 1684s > invoke_assert_code(args=[rules]) 1684s 1684s test/cli/commands_test.py:893: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0, args = [], kwargs = {}, cli_input = None 1684s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _________________________ test__cli__command_dialects __________________________ 1684s 1684s def test__cli__command_dialects(): 1684s """Check dialects command for exceptions.""" 1684s > invoke_assert_code(args=[dialects]) 1684s 1684s test/cli/commands_test.py:898: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0, args = [], kwargs = {}, cli_input = None 1684s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s __ test__cli__command__fix[LT01-test/fixtures/linter/indentation_errors.sql0] __ 1684s 1684s rule = 'LT01', fname = 'test/fixtures/linter/indentation_errors.sql' 1684s 1684s @pytest.mark.parametrize( 1684s "rule,fname", 1684s [ 1684s ("LT01", "test/fixtures/linter/indentation_errors.sql"), 1684s ("LT01", "test/fixtures/linter/whitespace_errors.sql"), 1684s ("LT01", "test/fixtures/linter/indentation_errors.sql"), 1684s # Really stretching the ability of the fixer to re-indent a file 1684s ("LT02", "test/fixtures/linter/indentation_error_hard.sql"), 1684s ], 1684s ) 1684s def test__cli__command__fix(rule, fname): 1684s """Test the round trip of detecting, fixing and then not detecting the rule.""" 1684s with open(fname) as test_file: 1684s > generic_roundtrip_test(test_file, rule) 1684s 1684s test/cli/commands_test.py:972: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s test/cli/commands_test.py:928: in generic_roundtrip_test 1684s invoke_assert_code( 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['--dialect=ansi', '--rules', 'LT01', '/tmp/tmpbbkwylqv/testing.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___ test__cli__command__fix[LT01-test/fixtures/linter/whitespace_errors.sql] ___ 1684s 1684s rule = 'LT01', fname = 'test/fixtures/linter/whitespace_errors.sql' 1684s 1684s @pytest.mark.parametrize( 1684s "rule,fname", 1684s [ 1684s ("LT01", "test/fixtures/linter/indentation_errors.sql"), 1684s ("LT01", "test/fixtures/linter/whitespace_errors.sql"), 1684s ("LT01", "test/fixtures/linter/indentation_errors.sql"), 1684s # Really stretching the ability of the fixer to re-indent a file 1684s ("LT02", "test/fixtures/linter/indentation_error_hard.sql"), 1684s ], 1684s ) 1684s def test__cli__command__fix(rule, fname): 1684s """Test the round trip of detecting, fixing and then not detecting the rule.""" 1684s with open(fname) as test_file: 1684s > generic_roundtrip_test(test_file, rule) 1684s 1684s test/cli/commands_test.py:972: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s test/cli/commands_test.py:928: in generic_roundtrip_test 1684s invoke_assert_code( 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['--dialect=ansi', '--rules', 'LT01', '/tmp/tmp81v0vg8o/testing.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s __ test__cli__command__fix[LT01-test/fixtures/linter/indentation_errors.sql1] __ 1684s 1684s rule = 'LT01', fname = 'test/fixtures/linter/indentation_errors.sql' 1684s 1684s @pytest.mark.parametrize( 1684s "rule,fname", 1684s [ 1684s ("LT01", "test/fixtures/linter/indentation_errors.sql"), 1684s ("LT01", "test/fixtures/linter/whitespace_errors.sql"), 1684s ("LT01", "test/fixtures/linter/indentation_errors.sql"), 1684s # Really stretching the ability of the fixer to re-indent a file 1684s ("LT02", "test/fixtures/linter/indentation_error_hard.sql"), 1684s ], 1684s ) 1684s def test__cli__command__fix(rule, fname): 1684s """Test the round trip of detecting, fixing and then not detecting the rule.""" 1684s with open(fname) as test_file: 1684s > generic_roundtrip_test(test_file, rule) 1684s 1684s test/cli/commands_test.py:972: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s test/cli/commands_test.py:928: in generic_roundtrip_test 1684s invoke_assert_code( 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['--dialect=ansi', '--rules', 'LT01', '/tmp/tmpxy1upado/testing.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ test__cli__command__fix[LT02-test/fixtures/linter/indentation_error_hard.sql] _ 1684s 1684s rule = 'LT02', fname = 'test/fixtures/linter/indentation_error_hard.sql' 1684s 1684s @pytest.mark.parametrize( 1684s "rule,fname", 1684s [ 1684s ("LT01", "test/fixtures/linter/indentation_errors.sql"), 1684s ("LT01", "test/fixtures/linter/whitespace_errors.sql"), 1684s ("LT01", "test/fixtures/linter/indentation_errors.sql"), 1684s # Really stretching the ability of the fixer to re-indent a file 1684s ("LT02", "test/fixtures/linter/indentation_error_hard.sql"), 1684s ], 1684s ) 1684s def test__cli__command__fix(rule, fname): 1684s """Test the round trip of detecting, fixing and then not detecting the rule.""" 1684s with open(fname) as test_file: 1684s > generic_roundtrip_test(test_file, rule) 1684s 1684s test/cli/commands_test.py:972: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s test/cli/commands_test.py:928: in generic_roundtrip_test 1684s invoke_assert_code( 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['--dialect=ansi', '--rules', 'LT02', '/tmp/tmp54rw_jkm/testing.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _______________ test_cli_fix_even_unparsable[command-line-False] _______________ 1684s 1684s method = 'command-line', fix_even_unparsable = False 1684s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x66e5a14b3f50> 1684s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_cli_fix_even_unparsable_c0') 1684s 1684s @pytest.mark.parametrize( 1684s "method,fix_even_unparsable", 1684s [ 1684s ("command-line", False), 1684s ("command-line", True), 1684s ("config-file", False), 1684s ("config-file", True), 1684s ], 1684s ) 1684s def test_cli_fix_even_unparsable( 1684s method: str, fix_even_unparsable: bool, monkeypatch, tmpdir 1684s ): 1684s """Test the fix_even_unparsable option works from cmd line and config.""" 1684s sql_filename = "fix_even_unparsable.sql" 1684s sql_path = str(tmpdir / sql_filename) 1684s with open(sql_path, "w") as f: 1684s print( 1684s """SELECT my_col 1684s FROM my_schema.my_table 1684s where processdate ! 3 1684s """, 1684s file=f, 1684s ) 1684s options = [ 1684s "--dialect", 1684s "ansi", 1684s "--fixed-suffix=FIXED", 1684s sql_path, 1684s ] 1684s if method == "command-line": 1684s if fix_even_unparsable: 1684s options.append("--FIX-EVEN-UNPARSABLE") 1684s else: 1684s assert method == "config-file" 1684s with open(str(tmpdir / ".sqlfluff"), "w") as f: 1684s print( 1684s f"[sqlfluff]\nfix_even_unparsable = {fix_even_unparsable}", 1684s file=f, 1684s ) 1684s # TRICKY: Switch current directory to the one with the SQL file. Otherwise, 1684s # the setting doesn't work. That's because SQLFluff reads it in 1684s # sqlfluff.cli.commands.fix(), prior to reading any file-specific settings 1684s # (down in sqlfluff.core.linter.Linter._load_raw_file_and_config()). 1684s monkeypatch.chdir(str(tmpdir)) 1684s > invoke_assert_code( 1684s ret_code=0 if fix_even_unparsable else 1, 1684s args=[ 1684s fix, 1684s options, 1684s ], 1684s ) 1684s 1684s /tmp/autopkgtest.oASYaB/autopkgtest_tmp/test/cli/commands_test.py:1178: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['--dialect', 'ansi', '--fixed-suffix=FIXED', '/tmp/pytest-of-ubuntu/pytest-0/test_cli_fix_even_unparsable_c0/fix_even_unparsable.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _______________ test_cli_fix_even_unparsable[command-line-True] ________________ 1684s 1684s method = 'command-line', fix_even_unparsable = True 1684s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x66e5a14b2a20> 1684s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_cli_fix_even_unparsable_c1') 1684s 1684s @pytest.mark.parametrize( 1684s "method,fix_even_unparsable", 1684s [ 1684s ("command-line", False), 1684s ("command-line", True), 1684s ("config-file", False), 1684s ("config-file", True), 1684s ], 1684s ) 1684s def test_cli_fix_even_unparsable( 1684s method: str, fix_even_unparsable: bool, monkeypatch, tmpdir 1684s ): 1684s """Test the fix_even_unparsable option works from cmd line and config.""" 1684s sql_filename = "fix_even_unparsable.sql" 1684s sql_path = str(tmpdir / sql_filename) 1684s with open(sql_path, "w") as f: 1684s print( 1684s """SELECT my_col 1684s FROM my_schema.my_table 1684s where processdate ! 3 1684s """, 1684s file=f, 1684s ) 1684s options = [ 1684s "--dialect", 1684s "ansi", 1684s "--fixed-suffix=FIXED", 1684s sql_path, 1684s ] 1684s if method == "command-line": 1684s if fix_even_unparsable: 1684s options.append("--FIX-EVEN-UNPARSABLE") 1684s else: 1684s assert method == "config-file" 1684s with open(str(tmpdir / ".sqlfluff"), "w") as f: 1684s print( 1684s f"[sqlfluff]\nfix_even_unparsable = {fix_even_unparsable}", 1684s file=f, 1684s ) 1684s # TRICKY: Switch current directory to the one with the SQL file. Otherwise, 1684s # the setting doesn't work. That's because SQLFluff reads it in 1684s # sqlfluff.cli.commands.fix(), prior to reading any file-specific settings 1684s # (down in sqlfluff.core.linter.Linter._load_raw_file_and_config()). 1684s monkeypatch.chdir(str(tmpdir)) 1684s > invoke_assert_code( 1684s ret_code=0 if fix_even_unparsable else 1, 1684s args=[ 1684s fix, 1684s options, 1684s ], 1684s ) 1684s 1684s /tmp/autopkgtest.oASYaB/autopkgtest_tmp/test/cli/commands_test.py:1178: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s 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']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _______________ test_cli_fix_even_unparsable[config-file-False] ________________ 1684s 1684s method = 'config-file', fix_even_unparsable = False 1684s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x66e5a14b11c0> 1684s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_cli_fix_even_unparsable_c2') 1684s 1684s @pytest.mark.parametrize( 1684s "method,fix_even_unparsable", 1684s [ 1684s ("command-line", False), 1684s ("command-line", True), 1684s ("config-file", False), 1684s ("config-file", True), 1684s ], 1684s ) 1684s def test_cli_fix_even_unparsable( 1684s method: str, fix_even_unparsable: bool, monkeypatch, tmpdir 1684s ): 1684s """Test the fix_even_unparsable option works from cmd line and config.""" 1684s sql_filename = "fix_even_unparsable.sql" 1684s sql_path = str(tmpdir / sql_filename) 1684s with open(sql_path, "w") as f: 1684s print( 1684s """SELECT my_col 1684s FROM my_schema.my_table 1684s where processdate ! 3 1684s """, 1684s file=f, 1684s ) 1684s options = [ 1684s "--dialect", 1684s "ansi", 1684s "--fixed-suffix=FIXED", 1684s sql_path, 1684s ] 1684s if method == "command-line": 1684s if fix_even_unparsable: 1684s options.append("--FIX-EVEN-UNPARSABLE") 1684s else: 1684s assert method == "config-file" 1684s with open(str(tmpdir / ".sqlfluff"), "w") as f: 1684s print( 1684s f"[sqlfluff]\nfix_even_unparsable = {fix_even_unparsable}", 1684s file=f, 1684s ) 1684s # TRICKY: Switch current directory to the one with the SQL file. Otherwise, 1684s # the setting doesn't work. That's because SQLFluff reads it in 1684s # sqlfluff.cli.commands.fix(), prior to reading any file-specific settings 1684s # (down in sqlfluff.core.linter.Linter._load_raw_file_and_config()). 1684s monkeypatch.chdir(str(tmpdir)) 1684s > invoke_assert_code( 1684s ret_code=0 if fix_even_unparsable else 1, 1684s args=[ 1684s fix, 1684s options, 1684s ], 1684s ) 1684s 1684s /tmp/autopkgtest.oASYaB/autopkgtest_tmp/test/cli/commands_test.py:1178: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['--dialect', 'ansi', '--fixed-suffix=FIXED', '/tmp/pytest-of-ubuntu/pytest-0/test_cli_fix_even_unparsable_c2/fix_even_unparsable.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ________________ test_cli_fix_even_unparsable[config-file-True] ________________ 1684s 1684s method = 'config-file', fix_even_unparsable = True 1684s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x66e5a149bec0> 1684s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_cli_fix_even_unparsable_c3') 1684s 1684s @pytest.mark.parametrize( 1684s "method,fix_even_unparsable", 1684s [ 1684s ("command-line", False), 1684s ("command-line", True), 1684s ("config-file", False), 1684s ("config-file", True), 1684s ], 1684s ) 1684s def test_cli_fix_even_unparsable( 1684s method: str, fix_even_unparsable: bool, monkeypatch, tmpdir 1684s ): 1684s """Test the fix_even_unparsable option works from cmd line and config.""" 1684s sql_filename = "fix_even_unparsable.sql" 1684s sql_path = str(tmpdir / sql_filename) 1684s with open(sql_path, "w") as f: 1684s print( 1684s """SELECT my_col 1684s FROM my_schema.my_table 1684s where processdate ! 3 1684s """, 1684s file=f, 1684s ) 1684s options = [ 1684s "--dialect", 1684s "ansi", 1684s "--fixed-suffix=FIXED", 1684s sql_path, 1684s ] 1684s if method == "command-line": 1684s if fix_even_unparsable: 1684s options.append("--FIX-EVEN-UNPARSABLE") 1684s else: 1684s assert method == "config-file" 1684s with open(str(tmpdir / ".sqlfluff"), "w") as f: 1684s print( 1684s f"[sqlfluff]\nfix_even_unparsable = {fix_even_unparsable}", 1684s file=f, 1684s ) 1684s # TRICKY: Switch current directory to the one with the SQL file. Otherwise, 1684s # the setting doesn't work. That's because SQLFluff reads it in 1684s # sqlfluff.cli.commands.fix(), prior to reading any file-specific settings 1684s # (down in sqlfluff.core.linter.Linter._load_raw_file_and_config()). 1684s monkeypatch.chdir(str(tmpdir)) 1684s > invoke_assert_code( 1684s ret_code=0 if fix_even_unparsable else 1, 1684s args=[ 1684s fix, 1684s options, 1684s ], 1684s ) 1684s 1684s /tmp/autopkgtest.oASYaB/autopkgtest_tmp/test/cli/commands_test.py:1178: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ['--dialect', 'ansi', '--fixed-suffix=FIXED', '/tmp/pytest-of-ubuntu/pytest-0/test_cli_fix_even_unparsable_c3/fix_even_unparsable.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ______ test__cli__command_fix_stdin[select * from t-LT02-select * from t] ______ 1684s 1684s stdin = 'select * from t', rules = 'LT02', stdout = 'select * from t' 1684s 1684s @pytest.mark.parametrize( 1684s "stdin,rules,stdout", 1684s [ 1684s ("select * from t", "LT02", "select * from t"), # no change 1684s ( 1684s " select * from t", 1684s "LT02", 1684s "select * from t", 1684s ), # fix preceding whitespace 1684s ], 1684s ) 1684s def test__cli__command_fix_stdin(stdin, rules, stdout): 1684s """Check stdin input for fix works.""" 1684s > result = invoke_assert_code( 1684s args=[ 1684s fix, 1684s ("-", "--rules", rules, "--disable-progress-bar", "--dialect=ansi"), 1684s ], 1684s cli_input=stdin, 1684s ) 1684s 1684s test/cli/commands_test.py:1213: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ('-', '--rules', 'LT02', '--disable-progress-bar', '--dialect=ansi')] 1684s kwargs = {'input': 'select * from t'}, cli_input = 'select * from t' 1684s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _____ test__cli__command_fix_stdin[ select * from t-LT02-select * from t] ______ 1684s 1684s stdin = ' select * from t', rules = 'LT02', stdout = 'select * from t' 1684s 1684s @pytest.mark.parametrize( 1684s "stdin,rules,stdout", 1684s [ 1684s ("select * from t", "LT02", "select * from t"), # no change 1684s ( 1684s " select * from t", 1684s "LT02", 1684s "select * from t", 1684s ), # fix preceding whitespace 1684s ], 1684s ) 1684s def test__cli__command_fix_stdin(stdin, rules, stdout): 1684s """Check stdin input for fix works.""" 1684s > result = invoke_assert_code( 1684s args=[ 1684s fix, 1684s ("-", "--rules", rules, "--disable-progress-bar", "--dialect=ansi"), 1684s ], 1684s cli_input=stdin, 1684s ) 1684s 1684s test/cli/commands_test.py:1213: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ('-', '--rules', 'LT02', '--disable-progress-bar', '--dialect=ansi')] 1684s kwargs = {'input': ' select * from t'}, cli_input = ' select * from t' 1684s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _____ test__cli__command_format_stdin[select * from t\n-select * from t\n] _____ 1684s 1684s stdin = 'select * from t\n', stdout = 'select * from t\n' 1684s 1684s @pytest.mark.parametrize( 1684s "stdin,stdout", 1684s [ 1684s ("select * from t\n", "select * from t\n"), # no change 1684s ( 1684s " select * FRoM t ", 1684s "select * from t\n", 1684s ), 1684s ( 1684s # Check that warnings related to parsing errors on input don't 1684s # go to stdout. This query shouldn't change, but stdout should 1684s # remain clean. 1684s # https://github.com/sqlfluff/sqlfluff/issues/5327 1684s "select\n" 1684s " count(*) over (\n" 1684s " order by a desc \n" 1684s " range between b row and '10 seconds' following -- noqa: PRS\n" 1684s " ) as c\n" 1684s "from d\n", 1684s "select\n" 1684s " count(*) over (\n" 1684s " order by a desc \n" 1684s " range between b row and '10 seconds' following -- noqa: PRS\n" 1684s " ) as c\n" 1684s "from d\n", 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_format_stdin(stdin, stdout): 1684s """Check stdin input for fix works.""" 1684s > result = invoke_assert_code( 1684s args=[ 1684s cli_format, 1684s ("-", "--disable-progress-bar", "--dialect=ansi"), 1684s ], 1684s cli_input=stdin, 1684s mix_stderr=False, 1684s ) 1684s 1684s test/cli/commands_test.py:1253: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ('-', '--disable-progress-bar', '--dialect=ansi')] 1684s kwargs = {'input': 'select * from t\n'}, cli_input = 'select * from t\n' 1684s mix_stderr = False, assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ test__cli__command_format_stdin[ select * FRoM t -select * from t\n] _ 1684s 1684s stdin = ' select * FRoM t ', stdout = 'select * from t\n' 1684s 1684s @pytest.mark.parametrize( 1684s "stdin,stdout", 1684s [ 1684s ("select * from t\n", "select * from t\n"), # no change 1684s ( 1684s " select * FRoM t ", 1684s "select * from t\n", 1684s ), 1684s ( 1684s # Check that warnings related to parsing errors on input don't 1684s # go to stdout. This query shouldn't change, but stdout should 1684s # remain clean. 1684s # https://github.com/sqlfluff/sqlfluff/issues/5327 1684s "select\n" 1684s " count(*) over (\n" 1684s " order by a desc \n" 1684s " range between b row and '10 seconds' following -- noqa: PRS\n" 1684s " ) as c\n" 1684s "from d\n", 1684s "select\n" 1684s " count(*) over (\n" 1684s " order by a desc \n" 1684s " range between b row and '10 seconds' following -- noqa: PRS\n" 1684s " ) as c\n" 1684s "from d\n", 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_format_stdin(stdin, stdout): 1684s """Check stdin input for fix works.""" 1684s > result = invoke_assert_code( 1684s args=[ 1684s cli_format, 1684s ("-", "--disable-progress-bar", "--dialect=ansi"), 1684s ], 1684s cli_input=stdin, 1684s mix_stderr=False, 1684s ) 1684s 1684s test/cli/commands_test.py:1253: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ('-', '--disable-progress-bar', '--dialect=ansi')] 1684s kwargs = {'input': ' select * FRoM t '} 1684s cli_input = ' select * FRoM t ', mix_stderr = False 1684s assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ 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] _ 1684s 1684s 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" 1684s 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" 1684s 1684s @pytest.mark.parametrize( 1684s "stdin,stdout", 1684s [ 1684s ("select * from t\n", "select * from t\n"), # no change 1684s ( 1684s " select * FRoM t ", 1684s "select * from t\n", 1684s ), 1684s ( 1684s # Check that warnings related to parsing errors on input don't 1684s # go to stdout. This query shouldn't change, but stdout should 1684s # remain clean. 1684s # https://github.com/sqlfluff/sqlfluff/issues/5327 1684s "select\n" 1684s " count(*) over (\n" 1684s " order by a desc \n" 1684s " range between b row and '10 seconds' following -- noqa: PRS\n" 1684s " ) as c\n" 1684s "from d\n", 1684s "select\n" 1684s " count(*) over (\n" 1684s " order by a desc \n" 1684s " range between b row and '10 seconds' following -- noqa: PRS\n" 1684s " ) as c\n" 1684s "from d\n", 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_format_stdin(stdin, stdout): 1684s """Check stdin input for fix works.""" 1684s > result = invoke_assert_code( 1684s args=[ 1684s cli_format, 1684s ("-", "--disable-progress-bar", "--dialect=ansi"), 1684s ], 1684s cli_input=stdin, 1684s mix_stderr=False, 1684s ) 1684s 1684s test/cli/commands_test.py:1253: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ('-', '--disable-progress-bar', '--dialect=ansi')] 1684s 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"} 1684s 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" 1684s mix_stderr = False, assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ________________ test__cli__command_fix_stdin_logging_to_stderr ________________ 1684s 1684s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x66e5a14b0860> 1684s 1684s def test__cli__command_fix_stdin_logging_to_stderr(monkeypatch): 1684s """Check that logging goes to stderr when stdin is passed to fix.""" 1684s perfect_sql = "select col from table" 1684s 1684s class MockLinter(sqlfluff.core.Linter): 1684s @classmethod 1684s def lint_fix_parsed(cls, *args, **kwargs): 1684s cls._warn_unfixable("") 1684s return super().lint_fix_parsed(*args, **kwargs) 1684s 1684s monkeypatch.setattr(sqlfluff.cli.commands, "Linter", MockLinter) 1684s > result = invoke_assert_code( 1684s args=[fix, ("-", "--rules=LT02", "--dialect=ansi")], 1684s cli_input=perfect_sql, 1684s mix_stderr=False, 1684s ) 1684s 1684s test/cli/commands_test.py:1275: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0, args = [, ('-', '--rules=LT02', '--dialect=ansi')] 1684s kwargs = {'input': 'select col from table'}, cli_input = 'select col from table' 1684s mix_stderr = False, assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _____________________ test__cli__command_fix_stdin_safety ______________________ 1684s 1684s def test__cli__command_fix_stdin_safety(): 1684s """Check edge cases regarding safety when fixing stdin.""" 1684s perfect_sql = "select col from table" 1684s 1684s # just prints the very same thing 1684s > result = invoke_assert_code( 1684s args=[fix, ("-", "--disable-progress-bar", "--dialect=ansi")], 1684s cli_input=perfect_sql, 1684s ) 1684s 1684s test/cli/commands_test.py:1290: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ('-', '--disable-progress-bar', '--dialect=ansi')] 1684s kwargs = {'input': 'select col from table'}, cli_input = 'select col from table' 1684s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ test__cli__command_fix_stdin_error_exit_code[create TABLE {{ params.dsfsdfds }}.t (a int)-1--v-Fix aborted due to unparsable template variables.] _ 1684s 1684s sql = 'create TABLE {{ params.dsfsdfds }}.t (a int)', exit_code = 1 1684s params = '-v' 1684s assert_output_contains = 'Fix aborted due to unparsable template variables.' 1684s 1684s @pytest.mark.parametrize( 1684s "sql,exit_code,params,assert_output_contains", 1684s [ 1684s ( 1684s "create TABLE {{ params.dsfsdfds }}.t (a int)", 1684s 1, 1684s "-v", 1684s "Fix aborted due to unparsable template variables.", 1684s ), # template error 1684s ("create TABLE a.t (a int)", 0, "", ""), # fixable error 1684s ("create table a.t (a int)", 0, "", ""), # perfection 1684s ( 1684s "select col from a join b using (c)", 1684s 1, 1684s "-v", 1684s "Unfixable violations detected.", 1684s ), # unfixable error (using) 1684s ], 1684s ) 1684s def test__cli__command_fix_stdin_error_exit_code( 1684s sql, exit_code, params, assert_output_contains 1684s ): 1684s """Check that the CLI fails nicely if fixing a templated stdin.""" 1684s > invoke_assert_code( 1684s ret_code=exit_code, 1684s args=[fix, ((params,) if params else ()) + ("--dialect=ansi", "-")], 1684s cli_input=sql, 1684s assert_output_contains=assert_output_contains, 1684s ) 1684s 1684s test/cli/commands_test.py:1320: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1, args = [, ('-v', '--dialect=ansi', '-')] 1684s kwargs = {'input': 'create TABLE {{ params.dsfsdfds }}.t (a int)'} 1684s cli_input = 'create TABLE {{ params.dsfsdfds }}.t (a int)', mix_stderr = True 1684s assert_output_contains = 'Fix aborted due to unparsable template variables.' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s __ test__cli__command_fix_stdin_error_exit_code[create TABLE a.t (a int)-0--] __ 1684s 1684s sql = 'create TABLE a.t (a int)', exit_code = 0, params = '' 1684s assert_output_contains = '' 1684s 1684s @pytest.mark.parametrize( 1684s "sql,exit_code,params,assert_output_contains", 1684s [ 1684s ( 1684s "create TABLE {{ params.dsfsdfds }}.t (a int)", 1684s 1, 1684s "-v", 1684s "Fix aborted due to unparsable template variables.", 1684s ), # template error 1684s ("create TABLE a.t (a int)", 0, "", ""), # fixable error 1684s ("create table a.t (a int)", 0, "", ""), # perfection 1684s ( 1684s "select col from a join b using (c)", 1684s 1, 1684s "-v", 1684s "Unfixable violations detected.", 1684s ), # unfixable error (using) 1684s ], 1684s ) 1684s def test__cli__command_fix_stdin_error_exit_code( 1684s sql, exit_code, params, assert_output_contains 1684s ): 1684s """Check that the CLI fails nicely if fixing a templated stdin.""" 1684s > invoke_assert_code( 1684s ret_code=exit_code, 1684s args=[fix, ((params,) if params else ()) + ("--dialect=ansi", "-")], 1684s cli_input=sql, 1684s assert_output_contains=assert_output_contains, 1684s ) 1684s 1684s test/cli/commands_test.py:1320: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0, args = [, ('--dialect=ansi', '-')] 1684s kwargs = {'input': 'create TABLE a.t (a int)'} 1684s cli_input = 'create TABLE a.t (a int)', mix_stderr = True 1684s assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s __ test__cli__command_fix_stdin_error_exit_code[create table a.t (a int)-0--] __ 1684s 1684s sql = 'create table a.t (a int)', exit_code = 0, params = '' 1684s assert_output_contains = '' 1684s 1684s @pytest.mark.parametrize( 1684s "sql,exit_code,params,assert_output_contains", 1684s [ 1684s ( 1684s "create TABLE {{ params.dsfsdfds }}.t (a int)", 1684s 1, 1684s "-v", 1684s "Fix aborted due to unparsable template variables.", 1684s ), # template error 1684s ("create TABLE a.t (a int)", 0, "", ""), # fixable error 1684s ("create table a.t (a int)", 0, "", ""), # perfection 1684s ( 1684s "select col from a join b using (c)", 1684s 1, 1684s "-v", 1684s "Unfixable violations detected.", 1684s ), # unfixable error (using) 1684s ], 1684s ) 1684s def test__cli__command_fix_stdin_error_exit_code( 1684s sql, exit_code, params, assert_output_contains 1684s ): 1684s """Check that the CLI fails nicely if fixing a templated stdin.""" 1684s > invoke_assert_code( 1684s ret_code=exit_code, 1684s args=[fix, ((params,) if params else ()) + ("--dialect=ansi", "-")], 1684s cli_input=sql, 1684s assert_output_contains=assert_output_contains, 1684s ) 1684s 1684s test/cli/commands_test.py:1320: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0, args = [, ('--dialect=ansi', '-')] 1684s kwargs = {'input': 'create table a.t (a int)'} 1684s cli_input = 'create table a.t (a int)', mix_stderr = True 1684s assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ test__cli__command_fix_stdin_error_exit_code[select col from a join b using (c)-1--v-Unfixable violations detected.] _ 1684s 1684s sql = 'select col from a join b using (c)', exit_code = 1, params = '-v' 1684s assert_output_contains = 'Unfixable violations detected.' 1684s 1684s @pytest.mark.parametrize( 1684s "sql,exit_code,params,assert_output_contains", 1684s [ 1684s ( 1684s "create TABLE {{ params.dsfsdfds }}.t (a int)", 1684s 1, 1684s "-v", 1684s "Fix aborted due to unparsable template variables.", 1684s ), # template error 1684s ("create TABLE a.t (a int)", 0, "", ""), # fixable error 1684s ("create table a.t (a int)", 0, "", ""), # perfection 1684s ( 1684s "select col from a join b using (c)", 1684s 1, 1684s "-v", 1684s "Unfixable violations detected.", 1684s ), # unfixable error (using) 1684s ], 1684s ) 1684s def test__cli__command_fix_stdin_error_exit_code( 1684s sql, exit_code, params, assert_output_contains 1684s ): 1684s """Check that the CLI fails nicely if fixing a templated stdin.""" 1684s > invoke_assert_code( 1684s ret_code=exit_code, 1684s args=[fix, ((params,) if params else ()) + ("--dialect=ansi", "-")], 1684s cli_input=sql, 1684s assert_output_contains=assert_output_contains, 1684s ) 1684s 1684s test/cli/commands_test.py:1320: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1, args = [, ('-v', '--dialect=ansi', '-')] 1684s kwargs = {'input': 'select col from a join b using (c)'} 1684s cli_input = 'select col from a join b using (c)', mix_stderr = True 1684s assert_output_contains = 'Unfixable violations detected.' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ test__cli__command__fix_check[LT01-test/fixtures/linter/indentation_errors.sql-y-0-0] _ 1684s 1684s rule = 'LT01', fname = 'test/fixtures/linter/indentation_errors.sql' 1684s prompt = 'y', exit_code = 0, fix_exit_code = 0 1684s 1684s @pytest.mark.parametrize( 1684s "rule,fname,prompt,exit_code,fix_exit_code", 1684s [ 1684s ("LT01", "test/fixtures/linter/indentation_errors.sql", "y", 0, 0), 1684s ("LT01", "test/fixtures/linter/indentation_errors.sql", "n", 1, 1), 1684s ], 1684s ) 1684s def test__cli__command__fix_check(rule, fname, prompt, exit_code, fix_exit_code): 1684s """Round trip test, using the prompts.""" 1684s with open(fname) as test_file: 1684s > generic_roundtrip_test( 1684s test_file, 1684s rule, 1684s check=True, 1684s final_exit_code=exit_code, 1684s fix_input=prompt, 1684s fix_exit_code=fix_exit_code, 1684s ) 1684s 1684s test/cli/commands_test.py:1338: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s test/cli/commands_test.py:928: in generic_roundtrip_test 1684s invoke_assert_code( 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['--dialect=ansi', '--rules', 'LT01', '/tmp/tmp5l_8sacx/testing.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ test__cli__command__fix_check[LT01-test/fixtures/linter/indentation_errors.sql-n-1-1] _ 1684s 1684s rule = 'LT01', fname = 'test/fixtures/linter/indentation_errors.sql' 1684s prompt = 'n', exit_code = 1, fix_exit_code = 1 1684s 1684s @pytest.mark.parametrize( 1684s "rule,fname,prompt,exit_code,fix_exit_code", 1684s [ 1684s ("LT01", "test/fixtures/linter/indentation_errors.sql", "y", 0, 0), 1684s ("LT01", "test/fixtures/linter/indentation_errors.sql", "n", 1, 1), 1684s ], 1684s ) 1684s def test__cli__command__fix_check(rule, fname, prompt, exit_code, fix_exit_code): 1684s """Round trip test, using the prompts.""" 1684s with open(fname) as test_file: 1684s > generic_roundtrip_test( 1684s test_file, 1684s rule, 1684s check=True, 1684s final_exit_code=exit_code, 1684s fix_input=prompt, 1684s fix_exit_code=fix_exit_code, 1684s ) 1684s 1684s test/cli/commands_test.py:1338: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s test/cli/commands_test.py:928: in generic_roundtrip_test 1684s invoke_assert_code( 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['--dialect=ansi', '--rules', 'LT01', '/tmp/tmpssu7r60t/testing.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________ test__cli__command_parse_serialize_from_stdin[None-yaml] ___________ 1684s 1684s serialize = 'yaml', write_file = None 1684s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_parse_seria0') 1684s 1684s @pytest.mark.parametrize("serialize", ["yaml", "json"]) 1684s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1684s def test__cli__command_parse_serialize_from_stdin(serialize, write_file, tmp_path): 1684s """Check that the parser serialized output option is working. 1684s 1684s This tests both output to stdout and output to file. 1684s 1684s Not going to test for the content of the output as that is subject to change. 1684s """ 1684s cmd_args = ("-", "--format", serialize, "--dialect=ansi") 1684s 1684s if write_file: 1684s target_file = os.path.join(tmp_path, write_file + "." + serialize) 1684s cmd_args += ("--write-output", target_file) 1684s 1684s > result = invoke_assert_code( 1684s args=[parse, cmd_args], 1684s cli_input="select * from tbl", 1684s ) 1684s 1684s test/cli/commands_test.py:1363: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ('-', '--format', 'yaml', '--dialect=ansi')] 1684s kwargs = {'input': 'select * from tbl'}, cli_input = 'select * from tbl' 1684s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___________ test__cli__command_parse_serialize_from_stdin[None-json] ___________ 1684s 1684s serialize = 'json', write_file = None 1684s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_parse_seria1') 1684s 1684s @pytest.mark.parametrize("serialize", ["yaml", "json"]) 1684s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1684s def test__cli__command_parse_serialize_from_stdin(serialize, write_file, tmp_path): 1684s """Check that the parser serialized output option is working. 1684s 1684s This tests both output to stdout and output to file. 1684s 1684s Not going to test for the content of the output as that is subject to change. 1684s """ 1684s cmd_args = ("-", "--format", serialize, "--dialect=ansi") 1684s 1684s if write_file: 1684s target_file = os.path.join(tmp_path, write_file + "." + serialize) 1684s cmd_args += ("--write-output", target_file) 1684s 1684s > result = invoke_assert_code( 1684s args=[parse, cmd_args], 1684s cli_input="select * from tbl", 1684s ) 1684s 1684s test/cli/commands_test.py:1363: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ('-', '--format', 'json', '--dialect=ansi')] 1684s kwargs = {'input': 'select * from tbl'}, cli_input = 'select * from tbl' 1684s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _________ test__cli__command_parse_serialize_from_stdin[outfile-yaml] __________ 1684s 1684s serialize = 'yaml', write_file = 'outfile' 1684s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_parse_seria2') 1684s 1684s @pytest.mark.parametrize("serialize", ["yaml", "json"]) 1684s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1684s def test__cli__command_parse_serialize_from_stdin(serialize, write_file, tmp_path): 1684s """Check that the parser serialized output option is working. 1684s 1684s This tests both output to stdout and output to file. 1684s 1684s Not going to test for the content of the output as that is subject to change. 1684s """ 1684s cmd_args = ("-", "--format", serialize, "--dialect=ansi") 1684s 1684s if write_file: 1684s target_file = os.path.join(tmp_path, write_file + "." + serialize) 1684s cmd_args += ("--write-output", target_file) 1684s 1684s > result = invoke_assert_code( 1684s args=[parse, cmd_args], 1684s cli_input="select * from tbl", 1684s ) 1684s 1684s test/cli/commands_test.py:1363: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ('-', '--format', 'yaml', '--dialect=ansi', '--write-output', '/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_parse_seria2/outfile.yaml')] 1684s kwargs = {'input': 'select * from tbl'}, cli_input = 'select * from tbl' 1684s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _________ test__cli__command_parse_serialize_from_stdin[outfile-json] __________ 1684s 1684s serialize = 'json', write_file = 'outfile' 1684s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_parse_seria3') 1684s 1684s @pytest.mark.parametrize("serialize", ["yaml", "json"]) 1684s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1684s def test__cli__command_parse_serialize_from_stdin(serialize, write_file, tmp_path): 1684s """Check that the parser serialized output option is working. 1684s 1684s This tests both output to stdout and output to file. 1684s 1684s Not going to test for the content of the output as that is subject to change. 1684s """ 1684s cmd_args = ("-", "--format", serialize, "--dialect=ansi") 1684s 1684s if write_file: 1684s target_file = os.path.join(tmp_path, write_file + "." + serialize) 1684s cmd_args += ("--write-output", target_file) 1684s 1684s > result = invoke_assert_code( 1684s args=[parse, cmd_args], 1684s cli_input="select * from tbl", 1684s ) 1684s 1684s test/cli/commands_test.py:1363: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ('-', '--format', 'json', '--dialect=ansi', '--write-output', '/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_parse_seria3/outfile.json')] 1684s kwargs = {'input': 'select * from tbl'}, cli_input = 'select * from tbl' 1684s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ test__cli__command_lint_serialize_from_stdin[select * from tbl-CP01-expected0-0-yaml] _ 1684s 1684s serialize = 'yaml', sql = 'select * from tbl', rules = 'CP01' 1684s expected = [{'filepath': 'stdin', 'statistics': {'raw_segments': 12, 'segments': 24, 'source_chars': 17, 'templated_chars': 17}, 'violations': []}] 1684s exit_code = 0 1684s 1684s @pytest.mark.parametrize("serialize", ["yaml", "json", "none"]) 1684s @pytest.mark.parametrize( 1684s "sql,rules,expected,exit_code", 1684s [ 1684s ( 1684s "select * from tbl", 1684s "CP01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "statistics": { 1684s "raw_segments": 12, 1684s "segments": 24, 1684s "source_chars": 17, 1684s "templated_chars": 17, 1684s }, 1684s # Empty list because no violations. 1684s "violations": [], 1684s } 1684s ], 1684s 0, 1684s ), 1684s ( 1684s "SElect * from tbl", 1684s "CP01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "violations": [ 1684s { 1684s "code": "CP01", 1684s "start_line_no": 1, 1684s "start_line_pos": 1, 1684s "start_file_pos": 0, 1684s "end_line_no": 1, 1684s "end_line_pos": 7, 1684s "end_file_pos": 6, 1684s "description": "Keywords must be consistently upper case.", 1684s "name": "capitalisation.keywords", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "SELECT", 1684s "start_line_no": 1, 1684s "start_line_pos": 1, 1684s "start_file_pos": 0, 1684s "end_line_no": 1, 1684s "end_line_pos": 7, 1684s "end_file_pos": 6, 1684s } 1684s ], 1684s }, 1684s { 1684s "code": "CP01", 1684s "start_line_no": 1, 1684s "start_line_pos": 10, 1684s "start_file_pos": 9, 1684s "end_line_no": 1, 1684s "end_line_pos": 14, 1684s "end_file_pos": 13, 1684s "description": "Keywords must be consistently upper case.", 1684s "name": "capitalisation.keywords", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "FROM", 1684s "start_line_no": 1, 1684s "start_line_pos": 10, 1684s "start_file_pos": 9, 1684s "end_line_no": 1, 1684s "end_line_pos": 14, 1684s "end_file_pos": 13, 1684s } 1684s ], 1684s }, 1684s ], 1684s "statistics": { 1684s "raw_segments": 12, 1684s "segments": 24, 1684s "source_chars": 17, 1684s "templated_chars": 17, 1684s }, 1684s # NOTE: There will be a timings section too, but we're not 1684s # going to test that. 1684s } 1684s ], 1684s 1, 1684s ), 1684s # Test serialisation with a source only fix. 1684s ( 1684s "SELECT {{1}}", 1684s "JJ01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "violations": [ 1684s { 1684s "code": "JJ01", 1684s "start_line_no": 1, 1684s "start_line_pos": 8, 1684s "start_file_pos": 7, 1684s "end_line_no": 1, 1684s "end_line_pos": 13, 1684s "end_file_pos": 12, 1684s "description": ( 1684s "Jinja tags should have a single whitespace on " 1684s "either side: {{1}}" 1684s ), 1684s "name": "jinja.padding", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "{{ 1 }}", 1684s "start_line_no": 1, 1684s "start_line_pos": 8, 1684s "start_file_pos": 7, 1684s "end_line_no": 1, 1684s "end_line_pos": 13, 1684s "end_file_pos": 12, 1684s } 1684s ], 1684s }, 1684s ], 1684s "statistics": { 1684s "raw_segments": 6, 1684s "segments": 11, 1684s "source_chars": 12, 1684s "templated_chars": 8, 1684s }, 1684s # NOTE: There will be a timings section too, but we're not 1684s # going to test that. 1684s } 1684s ], 1684s 1, 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_serialize_from_stdin( 1684s serialize, sql, rules, expected, exit_code 1684s ): 1684s """Check an explicit serialized return value for a single error.""" 1684s > result = invoke_assert_code( 1684s args=[ 1684s lint, 1684s ( 1684s "-", 1684s "--rules", 1684s rules, 1684s "--format", 1684s serialize, 1684s "--disable-progress-bar", 1684s "--dialect=ansi", 1684s ), 1684s ], 1684s cli_input=sql, 1684s ret_code=exit_code, 1684s ) 1684s 1684s test/cli/commands_test.py:1528: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ('-', '--rules', 'CP01', '--format', 'yaml', '--disable-progress-bar', ...)] 1684s kwargs = {'input': 'select * from tbl'}, cli_input = 'select * from tbl' 1684s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ test__cli__command_lint_serialize_from_stdin[select * from tbl-CP01-expected0-0-json] _ 1684s 1684s serialize = 'json', sql = 'select * from tbl', rules = 'CP01' 1684s expected = [{'filepath': 'stdin', 'statistics': {'raw_segments': 12, 'segments': 24, 'source_chars': 17, 'templated_chars': 17}, 'violations': []}] 1684s exit_code = 0 1684s 1684s @pytest.mark.parametrize("serialize", ["yaml", "json", "none"]) 1684s @pytest.mark.parametrize( 1684s "sql,rules,expected,exit_code", 1684s [ 1684s ( 1684s "select * from tbl", 1684s "CP01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "statistics": { 1684s "raw_segments": 12, 1684s "segments": 24, 1684s "source_chars": 17, 1684s "templated_chars": 17, 1684s }, 1684s # Empty list because no violations. 1684s "violations": [], 1684s } 1684s ], 1684s 0, 1684s ), 1684s ( 1684s "SElect * from tbl", 1684s "CP01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "violations": [ 1684s { 1684s "code": "CP01", 1684s "start_line_no": 1, 1684s "start_line_pos": 1, 1684s "start_file_pos": 0, 1684s "end_line_no": 1, 1684s "end_line_pos": 7, 1684s "end_file_pos": 6, 1684s "description": "Keywords must be consistently upper case.", 1684s "name": "capitalisation.keywords", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "SELECT", 1684s "start_line_no": 1, 1684s "start_line_pos": 1, 1684s "start_file_pos": 0, 1684s "end_line_no": 1, 1684s "end_line_pos": 7, 1684s "end_file_pos": 6, 1684s } 1684s ], 1684s }, 1684s { 1684s "code": "CP01", 1684s "start_line_no": 1, 1684s "start_line_pos": 10, 1684s "start_file_pos": 9, 1684s "end_line_no": 1, 1684s "end_line_pos": 14, 1684s "end_file_pos": 13, 1684s "description": "Keywords must be consistently upper case.", 1684s "name": "capitalisation.keywords", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "FROM", 1684s "start_line_no": 1, 1684s "start_line_pos": 10, 1684s "start_file_pos": 9, 1684s "end_line_no": 1, 1684s "end_line_pos": 14, 1684s "end_file_pos": 13, 1684s } 1684s ], 1684s }, 1684s ], 1684s "statistics": { 1684s "raw_segments": 12, 1684s "segments": 24, 1684s "source_chars": 17, 1684s "templated_chars": 17, 1684s }, 1684s # NOTE: There will be a timings section too, but we're not 1684s # going to test that. 1684s } 1684s ], 1684s 1, 1684s ), 1684s # Test serialisation with a source only fix. 1684s ( 1684s "SELECT {{1}}", 1684s "JJ01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "violations": [ 1684s { 1684s "code": "JJ01", 1684s "start_line_no": 1, 1684s "start_line_pos": 8, 1684s "start_file_pos": 7, 1684s "end_line_no": 1, 1684s "end_line_pos": 13, 1684s "end_file_pos": 12, 1684s "description": ( 1684s "Jinja tags should have a single whitespace on " 1684s "either side: {{1}}" 1684s ), 1684s "name": "jinja.padding", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "{{ 1 }}", 1684s "start_line_no": 1, 1684s "start_line_pos": 8, 1684s "start_file_pos": 7, 1684s "end_line_no": 1, 1684s "end_line_pos": 13, 1684s "end_file_pos": 12, 1684s } 1684s ], 1684s }, 1684s ], 1684s "statistics": { 1684s "raw_segments": 6, 1684s "segments": 11, 1684s "source_chars": 12, 1684s "templated_chars": 8, 1684s }, 1684s # NOTE: There will be a timings section too, but we're not 1684s # going to test that. 1684s } 1684s ], 1684s 1, 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_serialize_from_stdin( 1684s serialize, sql, rules, expected, exit_code 1684s ): 1684s """Check an explicit serialized return value for a single error.""" 1684s > result = invoke_assert_code( 1684s args=[ 1684s lint, 1684s ( 1684s "-", 1684s "--rules", 1684s rules, 1684s "--format", 1684s serialize, 1684s "--disable-progress-bar", 1684s "--dialect=ansi", 1684s ), 1684s ], 1684s cli_input=sql, 1684s ret_code=exit_code, 1684s ) 1684s 1684s test/cli/commands_test.py:1528: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ('-', '--rules', 'CP01', '--format', 'json', '--disable-progress-bar', ...)] 1684s kwargs = {'input': 'select * from tbl'}, cli_input = 'select * from tbl' 1684s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ test__cli__command_lint_serialize_from_stdin[select * from tbl-CP01-expected0-0-none] _ 1684s 1684s serialize = 'none', sql = 'select * from tbl', rules = 'CP01' 1684s expected = [{'filepath': 'stdin', 'statistics': {'raw_segments': 12, 'segments': 24, 'source_chars': 17, 'templated_chars': 17}, 'violations': []}] 1684s exit_code = 0 1684s 1684s @pytest.mark.parametrize("serialize", ["yaml", "json", "none"]) 1684s @pytest.mark.parametrize( 1684s "sql,rules,expected,exit_code", 1684s [ 1684s ( 1684s "select * from tbl", 1684s "CP01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "statistics": { 1684s "raw_segments": 12, 1684s "segments": 24, 1684s "source_chars": 17, 1684s "templated_chars": 17, 1684s }, 1684s # Empty list because no violations. 1684s "violations": [], 1684s } 1684s ], 1684s 0, 1684s ), 1684s ( 1684s "SElect * from tbl", 1684s "CP01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "violations": [ 1684s { 1684s "code": "CP01", 1684s "start_line_no": 1, 1684s "start_line_pos": 1, 1684s "start_file_pos": 0, 1684s "end_line_no": 1, 1684s "end_line_pos": 7, 1684s "end_file_pos": 6, 1684s "description": "Keywords must be consistently upper case.", 1684s "name": "capitalisation.keywords", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "SELECT", 1684s "start_line_no": 1, 1684s "start_line_pos": 1, 1684s "start_file_pos": 0, 1684s "end_line_no": 1, 1684s "end_line_pos": 7, 1684s "end_file_pos": 6, 1684s } 1684s ], 1684s }, 1684s { 1684s "code": "CP01", 1684s "start_line_no": 1, 1684s "start_line_pos": 10, 1684s "start_file_pos": 9, 1684s "end_line_no": 1, 1684s "end_line_pos": 14, 1684s "end_file_pos": 13, 1684s "description": "Keywords must be consistently upper case.", 1684s "name": "capitalisation.keywords", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "FROM", 1684s "start_line_no": 1, 1684s "start_line_pos": 10, 1684s "start_file_pos": 9, 1684s "end_line_no": 1, 1684s "end_line_pos": 14, 1684s "end_file_pos": 13, 1684s } 1684s ], 1684s }, 1684s ], 1684s "statistics": { 1684s "raw_segments": 12, 1684s "segments": 24, 1684s "source_chars": 17, 1684s "templated_chars": 17, 1684s }, 1684s # NOTE: There will be a timings section too, but we're not 1684s # going to test that. 1684s } 1684s ], 1684s 1, 1684s ), 1684s # Test serialisation with a source only fix. 1684s ( 1684s "SELECT {{1}}", 1684s "JJ01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "violations": [ 1684s { 1684s "code": "JJ01", 1684s "start_line_no": 1, 1684s "start_line_pos": 8, 1684s "start_file_pos": 7, 1684s "end_line_no": 1, 1684s "end_line_pos": 13, 1684s "end_file_pos": 12, 1684s "description": ( 1684s "Jinja tags should have a single whitespace on " 1684s "either side: {{1}}" 1684s ), 1684s "name": "jinja.padding", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "{{ 1 }}", 1684s "start_line_no": 1, 1684s "start_line_pos": 8, 1684s "start_file_pos": 7, 1684s "end_line_no": 1, 1684s "end_line_pos": 13, 1684s "end_file_pos": 12, 1684s } 1684s ], 1684s }, 1684s ], 1684s "statistics": { 1684s "raw_segments": 6, 1684s "segments": 11, 1684s "source_chars": 12, 1684s "templated_chars": 8, 1684s }, 1684s # NOTE: There will be a timings section too, but we're not 1684s # going to test that. 1684s } 1684s ], 1684s 1, 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_serialize_from_stdin( 1684s serialize, sql, rules, expected, exit_code 1684s ): 1684s """Check an explicit serialized return value for a single error.""" 1684s > result = invoke_assert_code( 1684s args=[ 1684s lint, 1684s ( 1684s "-", 1684s "--rules", 1684s rules, 1684s "--format", 1684s serialize, 1684s "--disable-progress-bar", 1684s "--dialect=ansi", 1684s ), 1684s ], 1684s cli_input=sql, 1684s ret_code=exit_code, 1684s ) 1684s 1684s test/cli/commands_test.py:1528: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ('-', '--rules', 'CP01', '--format', 'none', '--disable-progress-bar', ...)] 1684s kwargs = {'input': 'select * from tbl'}, cli_input = 'select * from tbl' 1684s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ test__cli__command_lint_serialize_from_stdin[SElect * from tbl-CP01-expected1-1-yaml] _ 1684s 1684s serialize = 'yaml', sql = 'SElect * from tbl', rules = 'CP01' 1684s 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, ...}]}] 1684s exit_code = 1 1684s 1684s @pytest.mark.parametrize("serialize", ["yaml", "json", "none"]) 1684s @pytest.mark.parametrize( 1684s "sql,rules,expected,exit_code", 1684s [ 1684s ( 1684s "select * from tbl", 1684s "CP01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "statistics": { 1684s "raw_segments": 12, 1684s "segments": 24, 1684s "source_chars": 17, 1684s "templated_chars": 17, 1684s }, 1684s # Empty list because no violations. 1684s "violations": [], 1684s } 1684s ], 1684s 0, 1684s ), 1684s ( 1684s "SElect * from tbl", 1684s "CP01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "violations": [ 1684s { 1684s "code": "CP01", 1684s "start_line_no": 1, 1684s "start_line_pos": 1, 1684s "start_file_pos": 0, 1684s "end_line_no": 1, 1684s "end_line_pos": 7, 1684s "end_file_pos": 6, 1684s "description": "Keywords must be consistently upper case.", 1684s "name": "capitalisation.keywords", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "SELECT", 1684s "start_line_no": 1, 1684s "start_line_pos": 1, 1684s "start_file_pos": 0, 1684s "end_line_no": 1, 1684s "end_line_pos": 7, 1684s "end_file_pos": 6, 1684s } 1684s ], 1684s }, 1684s { 1684s "code": "CP01", 1684s "start_line_no": 1, 1684s "start_line_pos": 10, 1684s "start_file_pos": 9, 1684s "end_line_no": 1, 1684s "end_line_pos": 14, 1684s "end_file_pos": 13, 1684s "description": "Keywords must be consistently upper case.", 1684s "name": "capitalisation.keywords", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "FROM", 1684s "start_line_no": 1, 1684s "start_line_pos": 10, 1684s "start_file_pos": 9, 1684s "end_line_no": 1, 1684s "end_line_pos": 14, 1684s "end_file_pos": 13, 1684s } 1684s ], 1684s }, 1684s ], 1684s "statistics": { 1684s "raw_segments": 12, 1684s "segments": 24, 1684s "source_chars": 17, 1684s "templated_chars": 17, 1684s }, 1684s # NOTE: There will be a timings section too, but we're not 1684s # going to test that. 1684s } 1684s ], 1684s 1, 1684s ), 1684s # Test serialisation with a source only fix. 1684s ( 1684s "SELECT {{1}}", 1684s "JJ01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "violations": [ 1684s { 1684s "code": "JJ01", 1684s "start_line_no": 1, 1684s "start_line_pos": 8, 1684s "start_file_pos": 7, 1684s "end_line_no": 1, 1684s "end_line_pos": 13, 1684s "end_file_pos": 12, 1684s "description": ( 1684s "Jinja tags should have a single whitespace on " 1684s "either side: {{1}}" 1684s ), 1684s "name": "jinja.padding", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "{{ 1 }}", 1684s "start_line_no": 1, 1684s "start_line_pos": 8, 1684s "start_file_pos": 7, 1684s "end_line_no": 1, 1684s "end_line_pos": 13, 1684s "end_file_pos": 12, 1684s } 1684s ], 1684s }, 1684s ], 1684s "statistics": { 1684s "raw_segments": 6, 1684s "segments": 11, 1684s "source_chars": 12, 1684s "templated_chars": 8, 1684s }, 1684s # NOTE: There will be a timings section too, but we're not 1684s # going to test that. 1684s } 1684s ], 1684s 1, 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_serialize_from_stdin( 1684s serialize, sql, rules, expected, exit_code 1684s ): 1684s """Check an explicit serialized return value for a single error.""" 1684s > result = invoke_assert_code( 1684s args=[ 1684s lint, 1684s ( 1684s "-", 1684s "--rules", 1684s rules, 1684s "--format", 1684s serialize, 1684s "--disable-progress-bar", 1684s "--dialect=ansi", 1684s ), 1684s ], 1684s cli_input=sql, 1684s ret_code=exit_code, 1684s ) 1684s 1684s test/cli/commands_test.py:1528: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ('-', '--rules', 'CP01', '--format', 'yaml', '--disable-progress-bar', ...)] 1684s kwargs = {'input': 'SElect * from tbl'}, cli_input = 'SElect * from tbl' 1684s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ test__cli__command_lint_serialize_from_stdin[SElect * from tbl-CP01-expected1-1-json] _ 1684s 1684s serialize = 'json', sql = 'SElect * from tbl', rules = 'CP01' 1684s 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, ...}]}] 1684s exit_code = 1 1684s 1684s @pytest.mark.parametrize("serialize", ["yaml", "json", "none"]) 1684s @pytest.mark.parametrize( 1684s "sql,rules,expected,exit_code", 1684s [ 1684s ( 1684s "select * from tbl", 1684s "CP01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "statistics": { 1684s "raw_segments": 12, 1684s "segments": 24, 1684s "source_chars": 17, 1684s "templated_chars": 17, 1684s }, 1684s # Empty list because no violations. 1684s "violations": [], 1684s } 1684s ], 1684s 0, 1684s ), 1684s ( 1684s "SElect * from tbl", 1684s "CP01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "violations": [ 1684s { 1684s "code": "CP01", 1684s "start_line_no": 1, 1684s "start_line_pos": 1, 1684s "start_file_pos": 0, 1684s "end_line_no": 1, 1684s "end_line_pos": 7, 1684s "end_file_pos": 6, 1684s "description": "Keywords must be consistently upper case.", 1684s "name": "capitalisation.keywords", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "SELECT", 1684s "start_line_no": 1, 1684s "start_line_pos": 1, 1684s "start_file_pos": 0, 1684s "end_line_no": 1, 1684s "end_line_pos": 7, 1684s "end_file_pos": 6, 1684s } 1684s ], 1684s }, 1684s { 1684s "code": "CP01", 1684s "start_line_no": 1, 1684s "start_line_pos": 10, 1684s "start_file_pos": 9, 1684s "end_line_no": 1, 1684s "end_line_pos": 14, 1684s "end_file_pos": 13, 1684s "description": "Keywords must be consistently upper case.", 1684s "name": "capitalisation.keywords", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "FROM", 1684s "start_line_no": 1, 1684s "start_line_pos": 10, 1684s "start_file_pos": 9, 1684s "end_line_no": 1, 1684s "end_line_pos": 14, 1684s "end_file_pos": 13, 1684s } 1684s ], 1684s }, 1684s ], 1684s "statistics": { 1684s "raw_segments": 12, 1684s "segments": 24, 1684s "source_chars": 17, 1684s "templated_chars": 17, 1684s }, 1684s # NOTE: There will be a timings section too, but we're not 1684s # going to test that. 1684s } 1684s ], 1684s 1, 1684s ), 1684s # Test serialisation with a source only fix. 1684s ( 1684s "SELECT {{1}}", 1684s "JJ01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "violations": [ 1684s { 1684s "code": "JJ01", 1684s "start_line_no": 1, 1684s "start_line_pos": 8, 1684s "start_file_pos": 7, 1684s "end_line_no": 1, 1684s "end_line_pos": 13, 1684s "end_file_pos": 12, 1684s "description": ( 1684s "Jinja tags should have a single whitespace on " 1684s "either side: {{1}}" 1684s ), 1684s "name": "jinja.padding", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "{{ 1 }}", 1684s "start_line_no": 1, 1684s "start_line_pos": 8, 1684s "start_file_pos": 7, 1684s "end_line_no": 1, 1684s "end_line_pos": 13, 1684s "end_file_pos": 12, 1684s } 1684s ], 1684s }, 1684s ], 1684s "statistics": { 1684s "raw_segments": 6, 1684s "segments": 11, 1684s "source_chars": 12, 1684s "templated_chars": 8, 1684s }, 1684s # NOTE: There will be a timings section too, but we're not 1684s # going to test that. 1684s } 1684s ], 1684s 1, 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_serialize_from_stdin( 1684s serialize, sql, rules, expected, exit_code 1684s ): 1684s """Check an explicit serialized return value for a single error.""" 1684s > result = invoke_assert_code( 1684s args=[ 1684s lint, 1684s ( 1684s "-", 1684s "--rules", 1684s rules, 1684s "--format", 1684s serialize, 1684s "--disable-progress-bar", 1684s "--dialect=ansi", 1684s ), 1684s ], 1684s cli_input=sql, 1684s ret_code=exit_code, 1684s ) 1684s 1684s test/cli/commands_test.py:1528: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ('-', '--rules', 'CP01', '--format', 'json', '--disable-progress-bar', ...)] 1684s kwargs = {'input': 'SElect * from tbl'}, cli_input = 'SElect * from tbl' 1684s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ test__cli__command_lint_serialize_from_stdin[SElect * from tbl-CP01-expected1-1-none] _ 1684s 1684s serialize = 'none', sql = 'SElect * from tbl', rules = 'CP01' 1684s 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, ...}]}] 1684s exit_code = 1 1684s 1684s @pytest.mark.parametrize("serialize", ["yaml", "json", "none"]) 1684s @pytest.mark.parametrize( 1684s "sql,rules,expected,exit_code", 1684s [ 1684s ( 1684s "select * from tbl", 1684s "CP01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "statistics": { 1684s "raw_segments": 12, 1684s "segments": 24, 1684s "source_chars": 17, 1684s "templated_chars": 17, 1684s }, 1684s # Empty list because no violations. 1684s "violations": [], 1684s } 1684s ], 1684s 0, 1684s ), 1684s ( 1684s "SElect * from tbl", 1684s "CP01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "violations": [ 1684s { 1684s "code": "CP01", 1684s "start_line_no": 1, 1684s "start_line_pos": 1, 1684s "start_file_pos": 0, 1684s "end_line_no": 1, 1684s "end_line_pos": 7, 1684s "end_file_pos": 6, 1684s "description": "Keywords must be consistently upper case.", 1684s "name": "capitalisation.keywords", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "SELECT", 1684s "start_line_no": 1, 1684s "start_line_pos": 1, 1684s "start_file_pos": 0, 1684s "end_line_no": 1, 1684s "end_line_pos": 7, 1684s "end_file_pos": 6, 1684s } 1684s ], 1684s }, 1684s { 1684s "code": "CP01", 1684s "start_line_no": 1, 1684s "start_line_pos": 10, 1684s "start_file_pos": 9, 1684s "end_line_no": 1, 1684s "end_line_pos": 14, 1684s "end_file_pos": 13, 1684s "description": "Keywords must be consistently upper case.", 1684s "name": "capitalisation.keywords", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "FROM", 1684s "start_line_no": 1, 1684s "start_line_pos": 10, 1684s "start_file_pos": 9, 1684s "end_line_no": 1, 1684s "end_line_pos": 14, 1684s "end_file_pos": 13, 1684s } 1684s ], 1684s }, 1684s ], 1684s "statistics": { 1684s "raw_segments": 12, 1684s "segments": 24, 1684s "source_chars": 17, 1684s "templated_chars": 17, 1684s }, 1684s # NOTE: There will be a timings section too, but we're not 1684s # going to test that. 1684s } 1684s ], 1684s 1, 1684s ), 1684s # Test serialisation with a source only fix. 1684s ( 1684s "SELECT {{1}}", 1684s "JJ01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "violations": [ 1684s { 1684s "code": "JJ01", 1684s "start_line_no": 1, 1684s "start_line_pos": 8, 1684s "start_file_pos": 7, 1684s "end_line_no": 1, 1684s "end_line_pos": 13, 1684s "end_file_pos": 12, 1684s "description": ( 1684s "Jinja tags should have a single whitespace on " 1684s "either side: {{1}}" 1684s ), 1684s "name": "jinja.padding", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "{{ 1 }}", 1684s "start_line_no": 1, 1684s "start_line_pos": 8, 1684s "start_file_pos": 7, 1684s "end_line_no": 1, 1684s "end_line_pos": 13, 1684s "end_file_pos": 12, 1684s } 1684s ], 1684s }, 1684s ], 1684s "statistics": { 1684s "raw_segments": 6, 1684s "segments": 11, 1684s "source_chars": 12, 1684s "templated_chars": 8, 1684s }, 1684s # NOTE: There will be a timings section too, but we're not 1684s # going to test that. 1684s } 1684s ], 1684s 1, 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_serialize_from_stdin( 1684s serialize, sql, rules, expected, exit_code 1684s ): 1684s """Check an explicit serialized return value for a single error.""" 1684s > result = invoke_assert_code( 1684s args=[ 1684s lint, 1684s ( 1684s "-", 1684s "--rules", 1684s rules, 1684s "--format", 1684s serialize, 1684s "--disable-progress-bar", 1684s "--dialect=ansi", 1684s ), 1684s ], 1684s cli_input=sql, 1684s ret_code=exit_code, 1684s ) 1684s 1684s test/cli/commands_test.py:1528: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ('-', '--rules', 'CP01', '--format', 'none', '--disable-progress-bar', ...)] 1684s kwargs = {'input': 'SElect * from tbl'}, cli_input = 'SElect * from tbl' 1684s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ test__cli__command_lint_serialize_from_stdin[SELECT {{1}}-JJ01-expected2-1-yaml] _ 1684s 1684s serialize = 'yaml', sql = 'SELECT {{1}}', rules = 'JJ01' 1684s 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, ...}]}] 1684s exit_code = 1 1684s 1684s @pytest.mark.parametrize("serialize", ["yaml", "json", "none"]) 1684s @pytest.mark.parametrize( 1684s "sql,rules,expected,exit_code", 1684s [ 1684s ( 1684s "select * from tbl", 1684s "CP01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "statistics": { 1684s "raw_segments": 12, 1684s "segments": 24, 1684s "source_chars": 17, 1684s "templated_chars": 17, 1684s }, 1684s # Empty list because no violations. 1684s "violations": [], 1684s } 1684s ], 1684s 0, 1684s ), 1684s ( 1684s "SElect * from tbl", 1684s "CP01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "violations": [ 1684s { 1684s "code": "CP01", 1684s "start_line_no": 1, 1684s "start_line_pos": 1, 1684s "start_file_pos": 0, 1684s "end_line_no": 1, 1684s "end_line_pos": 7, 1684s "end_file_pos": 6, 1684s "description": "Keywords must be consistently upper case.", 1684s "name": "capitalisation.keywords", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "SELECT", 1684s "start_line_no": 1, 1684s "start_line_pos": 1, 1684s "start_file_pos": 0, 1684s "end_line_no": 1, 1684s "end_line_pos": 7, 1684s "end_file_pos": 6, 1684s } 1684s ], 1684s }, 1684s { 1684s "code": "CP01", 1684s "start_line_no": 1, 1684s "start_line_pos": 10, 1684s "start_file_pos": 9, 1684s "end_line_no": 1, 1684s "end_line_pos": 14, 1684s "end_file_pos": 13, 1684s "description": "Keywords must be consistently upper case.", 1684s "name": "capitalisation.keywords", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "FROM", 1684s "start_line_no": 1, 1684s "start_line_pos": 10, 1684s "start_file_pos": 9, 1684s "end_line_no": 1, 1684s "end_line_pos": 14, 1684s "end_file_pos": 13, 1684s } 1684s ], 1684s }, 1684s ], 1684s "statistics": { 1684s "raw_segments": 12, 1684s "segments": 24, 1684s "source_chars": 17, 1684s "templated_chars": 17, 1684s }, 1684s # NOTE: There will be a timings section too, but we're not 1684s # going to test that. 1684s } 1684s ], 1684s 1, 1684s ), 1684s # Test serialisation with a source only fix. 1684s ( 1684s "SELECT {{1}}", 1684s "JJ01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "violations": [ 1684s { 1684s "code": "JJ01", 1684s "start_line_no": 1, 1684s "start_line_pos": 8, 1684s "start_file_pos": 7, 1684s "end_line_no": 1, 1684s "end_line_pos": 13, 1684s "end_file_pos": 12, 1684s "description": ( 1684s "Jinja tags should have a single whitespace on " 1684s "either side: {{1}}" 1684s ), 1684s "name": "jinja.padding", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "{{ 1 }}", 1684s "start_line_no": 1, 1684s "start_line_pos": 8, 1684s "start_file_pos": 7, 1684s "end_line_no": 1, 1684s "end_line_pos": 13, 1684s "end_file_pos": 12, 1684s } 1684s ], 1684s }, 1684s ], 1684s "statistics": { 1684s "raw_segments": 6, 1684s "segments": 11, 1684s "source_chars": 12, 1684s "templated_chars": 8, 1684s }, 1684s # NOTE: There will be a timings section too, but we're not 1684s # going to test that. 1684s } 1684s ], 1684s 1, 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_serialize_from_stdin( 1684s serialize, sql, rules, expected, exit_code 1684s ): 1684s """Check an explicit serialized return value for a single error.""" 1684s > result = invoke_assert_code( 1684s args=[ 1684s lint, 1684s ( 1684s "-", 1684s "--rules", 1684s rules, 1684s "--format", 1684s serialize, 1684s "--disable-progress-bar", 1684s "--dialect=ansi", 1684s ), 1684s ], 1684s cli_input=sql, 1684s ret_code=exit_code, 1684s ) 1684s 1684s test/cli/commands_test.py:1528: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ('-', '--rules', 'JJ01', '--format', 'yaml', '--disable-progress-bar', ...)] 1684s kwargs = {'input': 'SELECT {{1}}'}, cli_input = 'SELECT {{1}}' 1684s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ test__cli__command_lint_serialize_from_stdin[SELECT {{1}}-JJ01-expected2-1-json] _ 1684s 1684s serialize = 'json', sql = 'SELECT {{1}}', rules = 'JJ01' 1684s 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, ...}]}] 1684s exit_code = 1 1684s 1684s @pytest.mark.parametrize("serialize", ["yaml", "json", "none"]) 1684s @pytest.mark.parametrize( 1684s "sql,rules,expected,exit_code", 1684s [ 1684s ( 1684s "select * from tbl", 1684s "CP01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "statistics": { 1684s "raw_segments": 12, 1684s "segments": 24, 1684s "source_chars": 17, 1684s "templated_chars": 17, 1684s }, 1684s # Empty list because no violations. 1684s "violations": [], 1684s } 1684s ], 1684s 0, 1684s ), 1684s ( 1684s "SElect * from tbl", 1684s "CP01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "violations": [ 1684s { 1684s "code": "CP01", 1684s "start_line_no": 1, 1684s "start_line_pos": 1, 1684s "start_file_pos": 0, 1684s "end_line_no": 1, 1684s "end_line_pos": 7, 1684s "end_file_pos": 6, 1684s "description": "Keywords must be consistently upper case.", 1684s "name": "capitalisation.keywords", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "SELECT", 1684s "start_line_no": 1, 1684s "start_line_pos": 1, 1684s "start_file_pos": 0, 1684s "end_line_no": 1, 1684s "end_line_pos": 7, 1684s "end_file_pos": 6, 1684s } 1684s ], 1684s }, 1684s { 1684s "code": "CP01", 1684s "start_line_no": 1, 1684s "start_line_pos": 10, 1684s "start_file_pos": 9, 1684s "end_line_no": 1, 1684s "end_line_pos": 14, 1684s "end_file_pos": 13, 1684s "description": "Keywords must be consistently upper case.", 1684s "name": "capitalisation.keywords", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "FROM", 1684s "start_line_no": 1, 1684s "start_line_pos": 10, 1684s "start_file_pos": 9, 1684s "end_line_no": 1, 1684s "end_line_pos": 14, 1684s "end_file_pos": 13, 1684s } 1684s ], 1684s }, 1684s ], 1684s "statistics": { 1684s "raw_segments": 12, 1684s "segments": 24, 1684s "source_chars": 17, 1684s "templated_chars": 17, 1684s }, 1684s # NOTE: There will be a timings section too, but we're not 1684s # going to test that. 1684s } 1684s ], 1684s 1, 1684s ), 1684s # Test serialisation with a source only fix. 1684s ( 1684s "SELECT {{1}}", 1684s "JJ01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "violations": [ 1684s { 1684s "code": "JJ01", 1684s "start_line_no": 1, 1684s "start_line_pos": 8, 1684s "start_file_pos": 7, 1684s "end_line_no": 1, 1684s "end_line_pos": 13, 1684s "end_file_pos": 12, 1684s "description": ( 1684s "Jinja tags should have a single whitespace on " 1684s "either side: {{1}}" 1684s ), 1684s "name": "jinja.padding", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "{{ 1 }}", 1684s "start_line_no": 1, 1684s "start_line_pos": 8, 1684s "start_file_pos": 7, 1684s "end_line_no": 1, 1684s "end_line_pos": 13, 1684s "end_file_pos": 12, 1684s } 1684s ], 1684s }, 1684s ], 1684s "statistics": { 1684s "raw_segments": 6, 1684s "segments": 11, 1684s "source_chars": 12, 1684s "templated_chars": 8, 1684s }, 1684s # NOTE: There will be a timings section too, but we're not 1684s # going to test that. 1684s } 1684s ], 1684s 1, 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_serialize_from_stdin( 1684s serialize, sql, rules, expected, exit_code 1684s ): 1684s """Check an explicit serialized return value for a single error.""" 1684s > result = invoke_assert_code( 1684s args=[ 1684s lint, 1684s ( 1684s "-", 1684s "--rules", 1684s rules, 1684s "--format", 1684s serialize, 1684s "--disable-progress-bar", 1684s "--dialect=ansi", 1684s ), 1684s ], 1684s cli_input=sql, 1684s ret_code=exit_code, 1684s ) 1684s 1684s test/cli/commands_test.py:1528: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ('-', '--rules', 'JJ01', '--format', 'json', '--disable-progress-bar', ...)] 1684s kwargs = {'input': 'SELECT {{1}}'}, cli_input = 'SELECT {{1}}' 1684s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ test__cli__command_lint_serialize_from_stdin[SELECT {{1}}-JJ01-expected2-1-none] _ 1684s 1684s serialize = 'none', sql = 'SELECT {{1}}', rules = 'JJ01' 1684s 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, ...}]}] 1684s exit_code = 1 1684s 1684s @pytest.mark.parametrize("serialize", ["yaml", "json", "none"]) 1684s @pytest.mark.parametrize( 1684s "sql,rules,expected,exit_code", 1684s [ 1684s ( 1684s "select * from tbl", 1684s "CP01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "statistics": { 1684s "raw_segments": 12, 1684s "segments": 24, 1684s "source_chars": 17, 1684s "templated_chars": 17, 1684s }, 1684s # Empty list because no violations. 1684s "violations": [], 1684s } 1684s ], 1684s 0, 1684s ), 1684s ( 1684s "SElect * from tbl", 1684s "CP01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "violations": [ 1684s { 1684s "code": "CP01", 1684s "start_line_no": 1, 1684s "start_line_pos": 1, 1684s "start_file_pos": 0, 1684s "end_line_no": 1, 1684s "end_line_pos": 7, 1684s "end_file_pos": 6, 1684s "description": "Keywords must be consistently upper case.", 1684s "name": "capitalisation.keywords", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "SELECT", 1684s "start_line_no": 1, 1684s "start_line_pos": 1, 1684s "start_file_pos": 0, 1684s "end_line_no": 1, 1684s "end_line_pos": 7, 1684s "end_file_pos": 6, 1684s } 1684s ], 1684s }, 1684s { 1684s "code": "CP01", 1684s "start_line_no": 1, 1684s "start_line_pos": 10, 1684s "start_file_pos": 9, 1684s "end_line_no": 1, 1684s "end_line_pos": 14, 1684s "end_file_pos": 13, 1684s "description": "Keywords must be consistently upper case.", 1684s "name": "capitalisation.keywords", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "FROM", 1684s "start_line_no": 1, 1684s "start_line_pos": 10, 1684s "start_file_pos": 9, 1684s "end_line_no": 1, 1684s "end_line_pos": 14, 1684s "end_file_pos": 13, 1684s } 1684s ], 1684s }, 1684s ], 1684s "statistics": { 1684s "raw_segments": 12, 1684s "segments": 24, 1684s "source_chars": 17, 1684s "templated_chars": 17, 1684s }, 1684s # NOTE: There will be a timings section too, but we're not 1684s # going to test that. 1684s } 1684s ], 1684s 1, 1684s ), 1684s # Test serialisation with a source only fix. 1684s ( 1684s "SELECT {{1}}", 1684s "JJ01", 1684s [ 1684s { 1684s "filepath": "stdin", 1684s "violations": [ 1684s { 1684s "code": "JJ01", 1684s "start_line_no": 1, 1684s "start_line_pos": 8, 1684s "start_file_pos": 7, 1684s "end_line_no": 1, 1684s "end_line_pos": 13, 1684s "end_file_pos": 12, 1684s "description": ( 1684s "Jinja tags should have a single whitespace on " 1684s "either side: {{1}}" 1684s ), 1684s "name": "jinja.padding", 1684s "warning": False, 1684s "fixes": [ 1684s { 1684s "type": "replace", 1684s "edit": "{{ 1 }}", 1684s "start_line_no": 1, 1684s "start_line_pos": 8, 1684s "start_file_pos": 7, 1684s "end_line_no": 1, 1684s "end_line_pos": 13, 1684s "end_file_pos": 12, 1684s } 1684s ], 1684s }, 1684s ], 1684s "statistics": { 1684s "raw_segments": 6, 1684s "segments": 11, 1684s "source_chars": 12, 1684s "templated_chars": 8, 1684s }, 1684s # NOTE: There will be a timings section too, but we're not 1684s # going to test that. 1684s } 1684s ], 1684s 1, 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_serialize_from_stdin( 1684s serialize, sql, rules, expected, exit_code 1684s ): 1684s """Check an explicit serialized return value for a single error.""" 1684s > result = invoke_assert_code( 1684s args=[ 1684s lint, 1684s ( 1684s "-", 1684s "--rules", 1684s rules, 1684s "--format", 1684s serialize, 1684s "--disable-progress-bar", 1684s "--dialect=ansi", 1684s ), 1684s ], 1684s cli_input=sql, 1684s ret_code=exit_code, 1684s ) 1684s 1684s test/cli/commands_test.py:1528: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ('-', '--rules', 'JJ01', '--format', 'none', '--disable-progress-bar', ...)] 1684s kwargs = {'input': 'SELECT {{1}}'}, cli_input = 'SELECT {{1}}' 1684s mix_stderr = True, assert_output_contains = '', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _______________ test__cli__command_fail_nice_not_found[command0] _______________ 1684s 1684s command = [, 'this_file_does_not_exist.sql'] 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s [lint, ("this_file_does_not_exist.sql")], 1684s [fix, ("this_file_does_not_exist.sql")], 1684s ], 1684s ) 1684s def test__cli__command_fail_nice_not_found(command): 1684s """Check commands fail as expected when then don't find files.""" 1684s > invoke_assert_code( 1684s args=command, 1684s ret_code=2, 1684s assert_output_contains=( 1684s "User Error: Specified path does not exist. Check it/they " 1684s "exist(s): this_file_does_not_exist.sql" 1684s ), 1684s ) 1684s 1684s test/cli/commands_test.py:1574: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 2, args = [, 'this_file_does_not_exist.sql'] 1684s kwargs = {}, cli_input = None, mix_stderr = True 1684s assert_output_contains = 'User Error: Specified path does not exist. Check it/they exist(s): this_file_does_not_exist.sql' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _______________ test__cli__command_fail_nice_not_found[command1] _______________ 1684s 1684s command = [, 'this_file_does_not_exist.sql'] 1684s 1684s @pytest.mark.parametrize( 1684s "command", 1684s [ 1684s [lint, ("this_file_does_not_exist.sql")], 1684s [fix, ("this_file_does_not_exist.sql")], 1684s ], 1684s ) 1684s def test__cli__command_fail_nice_not_found(command): 1684s """Check commands fail as expected when then don't find files.""" 1684s > invoke_assert_code( 1684s args=command, 1684s ret_code=2, 1684s assert_output_contains=( 1684s "User Error: Specified path does not exist. Check it/they " 1684s "exist(s): this_file_does_not_exist.sql" 1684s ), 1684s ) 1684s 1684s test/cli/commands_test.py:1574: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 2, args = [, 'this_file_does_not_exist.sql'] 1684s kwargs = {}, cli_input = None, mix_stderr = True 1684s assert_output_contains = 'User Error: Specified path does not exist. Check it/they exist(s): this_file_does_not_exist.sql' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _________ test__cli__command_lint_serialize_multiple_files[None-human] _________ 1684s 1684s serialize = 'human', write_file = None 1684s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_lint_serial0') 1684s 1684s @pytest.mark.parametrize( 1684s "serialize", 1684s ["human", "yaml", "json", "github-annotation", "github-annotation-native", "none"], 1684s ) 1684s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1684s def test__cli__command_lint_serialize_multiple_files(serialize, write_file, tmp_path): 1684s """Test the output formats for multiple files. 1684s 1684s This tests runs both stdout checking and file checking. 1684s """ 1684s fpath1 = "test/fixtures/linter/indentation_errors.sql" 1684s fpath2 = "test/fixtures/linter/multiple_sql_errors.sql" 1684s 1684s cmd_args = ( 1684s fpath1, 1684s fpath2, 1684s "--format", 1684s serialize, 1684s "--disable-progress-bar", 1684s ) 1684s 1684s if write_file: 1684s ext = { 1684s "human": ".txt", 1684s "yaml": ".yaml", 1684s } 1684s target_file = os.path.join(tmp_path, write_file + ext.get(serialize, ".json")) 1684s cmd_args += ("--write-output", target_file) 1684s 1684s # note the file is in here twice. two files = two payloads. 1684s > result = invoke_assert_code( 1684s args=[lint, cmd_args], 1684s ret_code=1, 1684s ) 1684s 1684s test/cli/commands_test.py:1644: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ('test/fixtures/linter/indentation_errors.sql', 'test/fixtures/linter/multiple_sql_errors.sql', '--format', 'human', '--disable-progress-bar')] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _________ test__cli__command_lint_serialize_multiple_files[None-yaml] __________ 1684s 1684s serialize = 'yaml', write_file = None 1684s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_lint_serial1') 1684s 1684s @pytest.mark.parametrize( 1684s "serialize", 1684s ["human", "yaml", "json", "github-annotation", "github-annotation-native", "none"], 1684s ) 1684s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1684s def test__cli__command_lint_serialize_multiple_files(serialize, write_file, tmp_path): 1684s """Test the output formats for multiple files. 1684s 1684s This tests runs both stdout checking and file checking. 1684s """ 1684s fpath1 = "test/fixtures/linter/indentation_errors.sql" 1684s fpath2 = "test/fixtures/linter/multiple_sql_errors.sql" 1684s 1684s cmd_args = ( 1684s fpath1, 1684s fpath2, 1684s "--format", 1684s serialize, 1684s "--disable-progress-bar", 1684s ) 1684s 1684s if write_file: 1684s ext = { 1684s "human": ".txt", 1684s "yaml": ".yaml", 1684s } 1684s target_file = os.path.join(tmp_path, write_file + ext.get(serialize, ".json")) 1684s cmd_args += ("--write-output", target_file) 1684s 1684s # note the file is in here twice. two files = two payloads. 1684s > result = invoke_assert_code( 1684s args=[lint, cmd_args], 1684s ret_code=1, 1684s ) 1684s 1684s test/cli/commands_test.py:1644: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ('test/fixtures/linter/indentation_errors.sql', 'test/fixtures/linter/multiple_sql_errors.sql', '--format', 'yaml', '--disable-progress-bar')] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _________ test__cli__command_lint_serialize_multiple_files[None-json] __________ 1684s 1684s serialize = 'json', write_file = None 1684s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_lint_serial2') 1684s 1684s @pytest.mark.parametrize( 1684s "serialize", 1684s ["human", "yaml", "json", "github-annotation", "github-annotation-native", "none"], 1684s ) 1684s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1684s def test__cli__command_lint_serialize_multiple_files(serialize, write_file, tmp_path): 1684s """Test the output formats for multiple files. 1684s 1684s This tests runs both stdout checking and file checking. 1684s """ 1684s fpath1 = "test/fixtures/linter/indentation_errors.sql" 1684s fpath2 = "test/fixtures/linter/multiple_sql_errors.sql" 1684s 1684s cmd_args = ( 1684s fpath1, 1684s fpath2, 1684s "--format", 1684s serialize, 1684s "--disable-progress-bar", 1684s ) 1684s 1684s if write_file: 1684s ext = { 1684s "human": ".txt", 1684s "yaml": ".yaml", 1684s } 1684s target_file = os.path.join(tmp_path, write_file + ext.get(serialize, ".json")) 1684s cmd_args += ("--write-output", target_file) 1684s 1684s # note the file is in here twice. two files = two payloads. 1684s > result = invoke_assert_code( 1684s args=[lint, cmd_args], 1684s ret_code=1, 1684s ) 1684s 1684s test/cli/commands_test.py:1644: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ('test/fixtures/linter/indentation_errors.sql', 'test/fixtures/linter/multiple_sql_errors.sql', '--format', 'json', '--disable-progress-bar')] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ___ test__cli__command_lint_serialize_multiple_files[None-github-annotation] ___ 1684s 1684s serialize = 'github-annotation', write_file = None 1684s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_lint_serial3') 1684s 1684s @pytest.mark.parametrize( 1684s "serialize", 1684s ["human", "yaml", "json", "github-annotation", "github-annotation-native", "none"], 1684s ) 1684s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1684s def test__cli__command_lint_serialize_multiple_files(serialize, write_file, tmp_path): 1684s """Test the output formats for multiple files. 1684s 1684s This tests runs both stdout checking and file checking. 1684s """ 1684s fpath1 = "test/fixtures/linter/indentation_errors.sql" 1684s fpath2 = "test/fixtures/linter/multiple_sql_errors.sql" 1684s 1684s cmd_args = ( 1684s fpath1, 1684s fpath2, 1684s "--format", 1684s serialize, 1684s "--disable-progress-bar", 1684s ) 1684s 1684s if write_file: 1684s ext = { 1684s "human": ".txt", 1684s "yaml": ".yaml", 1684s } 1684s target_file = os.path.join(tmp_path, write_file + ext.get(serialize, ".json")) 1684s cmd_args += ("--write-output", target_file) 1684s 1684s # note the file is in here twice. two files = two payloads. 1684s > result = invoke_assert_code( 1684s args=[lint, cmd_args], 1684s ret_code=1, 1684s ) 1684s 1684s test/cli/commands_test.py:1644: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ('test/fixtures/linter/indentation_errors.sql', 'test/fixtures/linter/multiple_sql_errors.sql', '--format', 'github-annotation', '--disable-progress-bar')] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ test__cli__command_lint_serialize_multiple_files[None-github-annotation-native] _ 1684s 1684s serialize = 'github-annotation-native', write_file = None 1684s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_lint_serial4') 1684s 1684s @pytest.mark.parametrize( 1684s "serialize", 1684s ["human", "yaml", "json", "github-annotation", "github-annotation-native", "none"], 1684s ) 1684s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1684s def test__cli__command_lint_serialize_multiple_files(serialize, write_file, tmp_path): 1684s """Test the output formats for multiple files. 1684s 1684s This tests runs both stdout checking and file checking. 1684s """ 1684s fpath1 = "test/fixtures/linter/indentation_errors.sql" 1684s fpath2 = "test/fixtures/linter/multiple_sql_errors.sql" 1684s 1684s cmd_args = ( 1684s fpath1, 1684s fpath2, 1684s "--format", 1684s serialize, 1684s "--disable-progress-bar", 1684s ) 1684s 1684s if write_file: 1684s ext = { 1684s "human": ".txt", 1684s "yaml": ".yaml", 1684s } 1684s target_file = os.path.join(tmp_path, write_file + ext.get(serialize, ".json")) 1684s cmd_args += ("--write-output", target_file) 1684s 1684s # note the file is in here twice. two files = two payloads. 1684s > result = invoke_assert_code( 1684s args=[lint, cmd_args], 1684s ret_code=1, 1684s ) 1684s 1684s test/cli/commands_test.py:1644: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ('test/fixtures/linter/indentation_errors.sql', 'test/fixtures/linter/multiple_sql_errors.sql', '--format', 'github-annotation-native', '--disable-progress-bar')] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _________ test__cli__command_lint_serialize_multiple_files[None-none] __________ 1684s 1684s serialize = 'none', write_file = None 1684s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_lint_serial5') 1684s 1684s @pytest.mark.parametrize( 1684s "serialize", 1684s ["human", "yaml", "json", "github-annotation", "github-annotation-native", "none"], 1684s ) 1684s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1684s def test__cli__command_lint_serialize_multiple_files(serialize, write_file, tmp_path): 1684s """Test the output formats for multiple files. 1684s 1684s This tests runs both stdout checking and file checking. 1684s """ 1684s fpath1 = "test/fixtures/linter/indentation_errors.sql" 1684s fpath2 = "test/fixtures/linter/multiple_sql_errors.sql" 1684s 1684s cmd_args = ( 1684s fpath1, 1684s fpath2, 1684s "--format", 1684s serialize, 1684s "--disable-progress-bar", 1684s ) 1684s 1684s if write_file: 1684s ext = { 1684s "human": ".txt", 1684s "yaml": ".yaml", 1684s } 1684s target_file = os.path.join(tmp_path, write_file + ext.get(serialize, ".json")) 1684s cmd_args += ("--write-output", target_file) 1684s 1684s # note the file is in here twice. two files = two payloads. 1684s > result = invoke_assert_code( 1684s args=[lint, cmd_args], 1684s ret_code=1, 1684s ) 1684s 1684s test/cli/commands_test.py:1644: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ('test/fixtures/linter/indentation_errors.sql', 'test/fixtures/linter/multiple_sql_errors.sql', '--format', 'none', '--disable-progress-bar')] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _______ test__cli__command_lint_serialize_multiple_files[outfile-human] ________ 1684s 1684s serialize = 'human', write_file = 'outfile' 1684s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_lint_serial6') 1684s 1684s @pytest.mark.parametrize( 1684s "serialize", 1684s ["human", "yaml", "json", "github-annotation", "github-annotation-native", "none"], 1684s ) 1684s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1684s def test__cli__command_lint_serialize_multiple_files(serialize, write_file, tmp_path): 1684s """Test the output formats for multiple files. 1684s 1684s This tests runs both stdout checking and file checking. 1684s """ 1684s fpath1 = "test/fixtures/linter/indentation_errors.sql" 1684s fpath2 = "test/fixtures/linter/multiple_sql_errors.sql" 1684s 1684s cmd_args = ( 1684s fpath1, 1684s fpath2, 1684s "--format", 1684s serialize, 1684s "--disable-progress-bar", 1684s ) 1684s 1684s if write_file: 1684s ext = { 1684s "human": ".txt", 1684s "yaml": ".yaml", 1684s } 1684s target_file = os.path.join(tmp_path, write_file + ext.get(serialize, ".json")) 1684s cmd_args += ("--write-output", target_file) 1684s 1684s # note the file is in here twice. two files = two payloads. 1684s > result = invoke_assert_code( 1684s args=[lint, cmd_args], 1684s ret_code=1, 1684s ) 1684s 1684s test/cli/commands_test.py:1644: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ('test/fixtures/linter/indentation_errors.sql', 'test/fixtures/linter/multiple_sql_errors.sql', '--format', 'human', '--disable-progress-bar', '--write-output', ...)] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ________ test__cli__command_lint_serialize_multiple_files[outfile-yaml] ________ 1684s 1684s serialize = 'yaml', write_file = 'outfile' 1684s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_lint_serial7') 1684s 1684s @pytest.mark.parametrize( 1684s "serialize", 1684s ["human", "yaml", "json", "github-annotation", "github-annotation-native", "none"], 1684s ) 1684s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1684s def test__cli__command_lint_serialize_multiple_files(serialize, write_file, tmp_path): 1684s """Test the output formats for multiple files. 1684s 1684s This tests runs both stdout checking and file checking. 1684s """ 1684s fpath1 = "test/fixtures/linter/indentation_errors.sql" 1684s fpath2 = "test/fixtures/linter/multiple_sql_errors.sql" 1684s 1684s cmd_args = ( 1684s fpath1, 1684s fpath2, 1684s "--format", 1684s serialize, 1684s "--disable-progress-bar", 1684s ) 1684s 1684s if write_file: 1684s ext = { 1684s "human": ".txt", 1684s "yaml": ".yaml", 1684s } 1684s target_file = os.path.join(tmp_path, write_file + ext.get(serialize, ".json")) 1684s cmd_args += ("--write-output", target_file) 1684s 1684s # note the file is in here twice. two files = two payloads. 1684s > result = invoke_assert_code( 1684s args=[lint, cmd_args], 1684s ret_code=1, 1684s ) 1684s 1684s test/cli/commands_test.py:1644: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ('test/fixtures/linter/indentation_errors.sql', 'test/fixtures/linter/multiple_sql_errors.sql', '--format', 'yaml', '--disable-progress-bar', '--write-output', ...)] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ________ test__cli__command_lint_serialize_multiple_files[outfile-json] ________ 1684s 1684s serialize = 'json', write_file = 'outfile' 1684s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_lint_serial8') 1684s 1684s @pytest.mark.parametrize( 1684s "serialize", 1684s ["human", "yaml", "json", "github-annotation", "github-annotation-native", "none"], 1684s ) 1684s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1684s def test__cli__command_lint_serialize_multiple_files(serialize, write_file, tmp_path): 1684s """Test the output formats for multiple files. 1684s 1684s This tests runs both stdout checking and file checking. 1684s """ 1684s fpath1 = "test/fixtures/linter/indentation_errors.sql" 1684s fpath2 = "test/fixtures/linter/multiple_sql_errors.sql" 1684s 1684s cmd_args = ( 1684s fpath1, 1684s fpath2, 1684s "--format", 1684s serialize, 1684s "--disable-progress-bar", 1684s ) 1684s 1684s if write_file: 1684s ext = { 1684s "human": ".txt", 1684s "yaml": ".yaml", 1684s } 1684s target_file = os.path.join(tmp_path, write_file + ext.get(serialize, ".json")) 1684s cmd_args += ("--write-output", target_file) 1684s 1684s # note the file is in here twice. two files = two payloads. 1684s > result = invoke_assert_code( 1684s args=[lint, cmd_args], 1684s ret_code=1, 1684s ) 1684s 1684s test/cli/commands_test.py:1644: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ('test/fixtures/linter/indentation_errors.sql', 'test/fixtures/linter/multiple_sql_errors.sql', '--format', 'json', '--disable-progress-bar', '--write-output', ...)] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ test__cli__command_lint_serialize_multiple_files[outfile-github-annotation] __ 1684s 1684s serialize = 'github-annotation', write_file = 'outfile' 1684s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_lint_serial9') 1684s 1684s @pytest.mark.parametrize( 1684s "serialize", 1684s ["human", "yaml", "json", "github-annotation", "github-annotation-native", "none"], 1684s ) 1684s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1684s def test__cli__command_lint_serialize_multiple_files(serialize, write_file, tmp_path): 1684s """Test the output formats for multiple files. 1684s 1684s This tests runs both stdout checking and file checking. 1684s """ 1684s fpath1 = "test/fixtures/linter/indentation_errors.sql" 1684s fpath2 = "test/fixtures/linter/multiple_sql_errors.sql" 1684s 1684s cmd_args = ( 1684s fpath1, 1684s fpath2, 1684s "--format", 1684s serialize, 1684s "--disable-progress-bar", 1684s ) 1684s 1684s if write_file: 1684s ext = { 1684s "human": ".txt", 1684s "yaml": ".yaml", 1684s } 1684s target_file = os.path.join(tmp_path, write_file + ext.get(serialize, ".json")) 1684s cmd_args += ("--write-output", target_file) 1684s 1684s # note the file is in here twice. two files = two payloads. 1684s > result = invoke_assert_code( 1684s args=[lint, cmd_args], 1684s ret_code=1, 1684s ) 1684s 1684s test/cli/commands_test.py:1644: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ('test/fixtures/linter/indentation_errors.sql', 'test/fixtures/linter/multiple_sql_errors.sql', '--format', 'github-annotation', '--disable-progress-bar', '--write-output', ...)] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ test__cli__command_lint_serialize_multiple_files[outfile-github-annotation-native] _ 1684s 1684s serialize = 'github-annotation-native', write_file = 'outfile' 1684s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_lint_serial10') 1684s 1684s @pytest.mark.parametrize( 1684s "serialize", 1684s ["human", "yaml", "json", "github-annotation", "github-annotation-native", "none"], 1684s ) 1684s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1684s def test__cli__command_lint_serialize_multiple_files(serialize, write_file, tmp_path): 1684s """Test the output formats for multiple files. 1684s 1684s This tests runs both stdout checking and file checking. 1684s """ 1684s fpath1 = "test/fixtures/linter/indentation_errors.sql" 1684s fpath2 = "test/fixtures/linter/multiple_sql_errors.sql" 1684s 1684s cmd_args = ( 1684s fpath1, 1684s fpath2, 1684s "--format", 1684s serialize, 1684s "--disable-progress-bar", 1684s ) 1684s 1684s if write_file: 1684s ext = { 1684s "human": ".txt", 1684s "yaml": ".yaml", 1684s } 1684s target_file = os.path.join(tmp_path, write_file + ext.get(serialize, ".json")) 1684s cmd_args += ("--write-output", target_file) 1684s 1684s # note the file is in here twice. two files = two payloads. 1684s > result = invoke_assert_code( 1684s args=[lint, cmd_args], 1684s ret_code=1, 1684s ) 1684s 1684s test/cli/commands_test.py:1644: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ('test/fixtures/linter/indentation_errors.sql', 'test/fixtures/linter/multiple_sql_errors.sql', '--format', 'github-annotation-native', '--disable-progress-bar', '--write-output', ...)] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ________ test__cli__command_lint_serialize_multiple_files[outfile-none] ________ 1684s 1684s serialize = 'none', write_file = 'outfile' 1684s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test__cli__command_lint_serial11') 1684s 1684s @pytest.mark.parametrize( 1684s "serialize", 1684s ["human", "yaml", "json", "github-annotation", "github-annotation-native", "none"], 1684s ) 1684s @pytest.mark.parametrize("write_file", [None, "outfile"]) 1684s def test__cli__command_lint_serialize_multiple_files(serialize, write_file, tmp_path): 1684s """Test the output formats for multiple files. 1684s 1684s This tests runs both stdout checking and file checking. 1684s """ 1684s fpath1 = "test/fixtures/linter/indentation_errors.sql" 1684s fpath2 = "test/fixtures/linter/multiple_sql_errors.sql" 1684s 1684s cmd_args = ( 1684s fpath1, 1684s fpath2, 1684s "--format", 1684s serialize, 1684s "--disable-progress-bar", 1684s ) 1684s 1684s if write_file: 1684s ext = { 1684s "human": ".txt", 1684s "yaml": ".yaml", 1684s } 1684s target_file = os.path.join(tmp_path, write_file + ext.get(serialize, ".json")) 1684s cmd_args += ("--write-output", target_file) 1684s 1684s # note the file is in here twice. two files = two payloads. 1684s > result = invoke_assert_code( 1684s args=[lint, cmd_args], 1684s ret_code=1, 1684s ) 1684s 1684s test/cli/commands_test.py:1644: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ('test/fixtures/linter/indentation_errors.sql', 'test/fixtures/linter/multiple_sql_errors.sql', '--format', 'none', '--disable-progress-bar', '--write-output', ...)] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _____________ test__cli__command_lint_serialize_github_annotation ______________ 1684s 1684s def test__cli__command_lint_serialize_github_annotation(): 1684s """Test format of github-annotation output.""" 1684s fpath = "test/fixtures/linter/identifier_capitalisation.sql" 1684s > result = invoke_assert_code( 1684s args=[ 1684s lint, 1684s ( 1684s fpath, 1684s "--format", 1684s "github-annotation", 1684s "--annotation-level", 1684s "warning", 1684s "--disable-progress-bar", 1684s ), 1684s ], 1684s ret_code=1, 1684s ) 1684s 1684s test/cli/commands_test.py:1690: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ('test/fixtures/linter/identifier_capitalisation.sql', '--format', 'github-annotation', '--annotation-level', 'warning', '--disable-progress-bar')] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ 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] _ 1684s 1684s filename = 'test/fixtures/linter/identifier_capitalisation.sql' 1684s 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' 1684s 1684s @pytest.mark.parametrize( 1684s "filename,expected_output", 1684s [ 1684s ( 1684s "test/fixtures/linter/identifier_capitalisation.sql", 1684s ( 1684s "::group::{filename}\n" 1684s "::error title=SQLFluff,file={filename}," 1684s "line=3,col=5,endLine=3,endColumn=8::" 1684s "RF02: Unqualified reference 'foo' found in select with more than one " 1684s "referenced table/view. [references.qualification]\n" 1684s "::error title=SQLFluff,file={filename}," 1684s "line=4,col=1,endLine=4,endColumn=5::" 1684s "LT02: Expected indent of 8 spaces. [layout.indent]\n" 1684s "::error title=SQLFluff,file={filename}," 1684s "line=4,col=5,endLine=4,endColumn=8::" 1684s "AL02: Implicit/explicit aliasing of columns. [aliasing.column]\n" 1684s "::error title=SQLFluff,file={filename}," 1684s "line=4,col=5,endLine=4,endColumn=8::" 1684s "CP02: Unquoted identifiers must be consistently lower case. " 1684s "[capitalisation.identifiers]\n" 1684s # Warnings should always come through as notices. 1684s "::notice title=SQLFluff,file={filename}," 1684s "line=5,col=1,endLine=5,endColumn=5::" 1684s "CP01: Keywords must be consistently lower case. " 1684s "[capitalisation.keywords]\n" 1684s "::error title=SQLFluff,file={filename}," 1684s "line=5,col=12,endLine=5,endColumn=16::" 1684s "CP02: Unquoted identifiers must be consistently lower case. " 1684s "[capitalisation.identifiers]\n" 1684s "::error title=SQLFluff,file={filename}," 1684s "line=5,col=18,endLine=5,endColumn=22::" 1684s "CP02: Unquoted identifiers must be consistently lower case. " 1684s "[capitalisation.identifiers]\n" 1684s "::endgroup::\n" 1684s # SQLFluff produces trailing newline 1684s ), 1684s ), 1684s ( 1684s "test/fixtures/linter/jinja_spacing.sql", 1684s ( 1684s "::group::{filename}\n" 1684s "::error title=SQLFluff,file={filename}," 1684s "line=3,col=15,endLine=3,endColumn=22::JJ01: " 1684s "Jinja tags should have a single whitespace on either " 1684s # NOTE: Double escaping, because we're going to pass this through a 1684s # .format() method. 1684s "side: {{{{foo}}}} " 1684s "[jinja.padding]\n" 1684s "::endgroup::\n" 1684s ), 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_serialize_github_annotation_native( 1684s filename, expected_output 1684s ): 1684s """Test format of github-annotation output.""" 1684s # Normalise paths to control for OS variance 1684s fpath_normalised = os.path.normpath(filename) 1684s 1684s > result = invoke_assert_code( 1684s args=[ 1684s lint, 1684s ( 1684s filename, 1684s "--format", 1684s "github-annotation-native", 1684s "--annotation-level", 1684s "error", 1684s "--disable-progress-bar", 1684s ), 1684s ], 1684s ret_code=1, 1684s ) 1684s 1684s test/cli/commands_test.py:1863: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ('test/fixtures/linter/identifier_capitalisation.sql', '--format', 'github-annotation-native', '--annotation-level', 'error', '--disable-progress-bar')] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ 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] _ 1684s 1684s filename = 'test/fixtures/linter/jinja_spacing.sql' 1684s 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' 1684s 1684s @pytest.mark.parametrize( 1684s "filename,expected_output", 1684s [ 1684s ( 1684s "test/fixtures/linter/identifier_capitalisation.sql", 1684s ( 1684s "::group::{filename}\n" 1684s "::error title=SQLFluff,file={filename}," 1684s "line=3,col=5,endLine=3,endColumn=8::" 1684s "RF02: Unqualified reference 'foo' found in select with more than one " 1684s "referenced table/view. [references.qualification]\n" 1684s "::error title=SQLFluff,file={filename}," 1684s "line=4,col=1,endLine=4,endColumn=5::" 1684s "LT02: Expected indent of 8 spaces. [layout.indent]\n" 1684s "::error title=SQLFluff,file={filename}," 1684s "line=4,col=5,endLine=4,endColumn=8::" 1684s "AL02: Implicit/explicit aliasing of columns. [aliasing.column]\n" 1684s "::error title=SQLFluff,file={filename}," 1684s "line=4,col=5,endLine=4,endColumn=8::" 1684s "CP02: Unquoted identifiers must be consistently lower case. " 1684s "[capitalisation.identifiers]\n" 1684s # Warnings should always come through as notices. 1684s "::notice title=SQLFluff,file={filename}," 1684s "line=5,col=1,endLine=5,endColumn=5::" 1684s "CP01: Keywords must be consistently lower case. " 1684s "[capitalisation.keywords]\n" 1684s "::error title=SQLFluff,file={filename}," 1684s "line=5,col=12,endLine=5,endColumn=16::" 1684s "CP02: Unquoted identifiers must be consistently lower case. " 1684s "[capitalisation.identifiers]\n" 1684s "::error title=SQLFluff,file={filename}," 1684s "line=5,col=18,endLine=5,endColumn=22::" 1684s "CP02: Unquoted identifiers must be consistently lower case. " 1684s "[capitalisation.identifiers]\n" 1684s "::endgroup::\n" 1684s # SQLFluff produces trailing newline 1684s ), 1684s ), 1684s ( 1684s "test/fixtures/linter/jinja_spacing.sql", 1684s ( 1684s "::group::{filename}\n" 1684s "::error title=SQLFluff,file={filename}," 1684s "line=3,col=15,endLine=3,endColumn=22::JJ01: " 1684s "Jinja tags should have a single whitespace on either " 1684s # NOTE: Double escaping, because we're going to pass this through a 1684s # .format() method. 1684s "side: {{{{foo}}}} " 1684s "[jinja.padding]\n" 1684s "::endgroup::\n" 1684s ), 1684s ), 1684s ], 1684s ) 1684s def test__cli__command_lint_serialize_github_annotation_native( 1684s filename, expected_output 1684s ): 1684s """Test format of github-annotation output.""" 1684s # Normalise paths to control for OS variance 1684s fpath_normalised = os.path.normpath(filename) 1684s 1684s > result = invoke_assert_code( 1684s args=[ 1684s lint, 1684s ( 1684s filename, 1684s "--format", 1684s "github-annotation-native", 1684s "--annotation-level", 1684s "error", 1684s "--disable-progress-bar", 1684s ), 1684s ], 1684s ret_code=1, 1684s ) 1684s 1684s test/cli/commands_test.py:1863: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ('test/fixtures/linter/jinja_spacing.sql', '--format', 'github-annotation-native', '--annotation-level', 'error', '--disable-progress-bar')] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ test__cli__command_lint_serialize_annotation_level_error_failure_equivalent[github-annotation] _ 1684s 1684s serialize = 'github-annotation' 1684s 1684s @pytest.mark.parametrize("serialize", ["github-annotation", "github-annotation-native"]) 1684s def test__cli__command_lint_serialize_annotation_level_error_failure_equivalent( 1684s serialize, 1684s ): 1684s """Test format of github-annotation output.""" 1684s fpath = "test/fixtures/linter/identifier_capitalisation.sql" 1684s > result_error = invoke_assert_code( 1684s args=[ 1684s lint, 1684s ( 1684s fpath, 1684s "--format", 1684s serialize, 1684s "--annotation-level", 1684s "error", 1684s "--disable-progress-bar", 1684s ), 1684s ], 1684s ret_code=1, 1684s ) 1684s 1684s test/cli/commands_test.py:1886: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ('test/fixtures/linter/identifier_capitalisation.sql', '--format', 'github-annotation', '--annotation-level', 'error', '--disable-progress-bar')] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _ test__cli__command_lint_serialize_annotation_level_error_failure_equivalent[github-annotation-native] _ 1684s 1684s serialize = 'github-annotation-native' 1684s 1684s @pytest.mark.parametrize("serialize", ["github-annotation", "github-annotation-native"]) 1684s def test__cli__command_lint_serialize_annotation_level_error_failure_equivalent( 1684s serialize, 1684s ): 1684s """Test format of github-annotation output.""" 1684s fpath = "test/fixtures/linter/identifier_capitalisation.sql" 1684s > result_error = invoke_assert_code( 1684s args=[ 1684s lint, 1684s ( 1684s fpath, 1684s "--format", 1684s serialize, 1684s "--annotation-level", 1684s "error", 1684s "--disable-progress-bar", 1684s ), 1684s ], 1684s ret_code=1, 1684s ) 1684s 1684s test/cli/commands_test.py:1886: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ('test/fixtures/linter/identifier_capitalisation.sql', '--format', 'github-annotation-native', '--annotation-level', 'error', '--disable-progress-bar')] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s __________________________ test_encoding[utf-8-ascii] __________________________ 1684s 1684s encoding_in = 'utf-8', encoding_out = 'ascii' 1684s 1684s @pytest.mark.parametrize( 1684s "encoding_in,encoding_out", 1684s [ 1684s ("utf-8", "ascii"), # chardet will detect ascii as a subset of utf-8 1684s ("utf-8-sig", "UTF-8-SIG"), 1684s ("utf-32", "UTF-32"), 1684s ], 1684s ) 1684s def test_encoding(encoding_in, encoding_out): 1684s """Check the encoding of the test file remains the same after fix is applied.""" 1684s with open("test/fixtures/linter/indentation_errors.sql", "r") as testfile: 1684s > generic_roundtrip_test( 1684s testfile, 1684s "LT01", 1684s input_file_encoding=encoding_in, 1684s output_file_encoding=encoding_out, 1684s ) 1684s 1684s test/cli/commands_test.py:1938: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s test/cli/commands_test.py:928: in generic_roundtrip_test 1684s invoke_assert_code( 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['--dialect=ansi', '--rules', 'LT01', '/tmp/tmp9kg2odwn/testing.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ______________________ test_encoding[utf-8-sig-UTF-8-SIG] ______________________ 1684s 1684s encoding_in = 'utf-8-sig', encoding_out = 'UTF-8-SIG' 1684s 1684s @pytest.mark.parametrize( 1684s "encoding_in,encoding_out", 1684s [ 1684s ("utf-8", "ascii"), # chardet will detect ascii as a subset of utf-8 1684s ("utf-8-sig", "UTF-8-SIG"), 1684s ("utf-32", "UTF-32"), 1684s ], 1684s ) 1684s def test_encoding(encoding_in, encoding_out): 1684s """Check the encoding of the test file remains the same after fix is applied.""" 1684s with open("test/fixtures/linter/indentation_errors.sql", "r") as testfile: 1684s > generic_roundtrip_test( 1684s testfile, 1684s "LT01", 1684s input_file_encoding=encoding_in, 1684s output_file_encoding=encoding_out, 1684s ) 1684s 1684s test/cli/commands_test.py:1938: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s test/cli/commands_test.py:928: in generic_roundtrip_test 1684s invoke_assert_code( 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['--dialect=ansi', '--rules', 'LT01', '/tmp/tmpnx1x80c1/testing.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _________________________ test_encoding[utf-32-UTF-32] _________________________ 1684s 1684s encoding_in = 'utf-32', encoding_out = 'UTF-32' 1684s 1684s @pytest.mark.parametrize( 1684s "encoding_in,encoding_out", 1684s [ 1684s ("utf-8", "ascii"), # chardet will detect ascii as a subset of utf-8 1684s ("utf-8-sig", "UTF-8-SIG"), 1684s ("utf-32", "UTF-32"), 1684s ], 1684s ) 1684s def test_encoding(encoding_in, encoding_out): 1684s """Check the encoding of the test file remains the same after fix is applied.""" 1684s with open("test/fixtures/linter/indentation_errors.sql", "r") as testfile: 1684s > generic_roundtrip_test( 1684s testfile, 1684s "LT01", 1684s input_file_encoding=encoding_in, 1684s output_file_encoding=encoding_out, 1684s ) 1684s 1684s test/cli/commands_test.py:1938: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s test/cli/commands_test.py:928: in generic_roundtrip_test 1684s invoke_assert_code( 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['--dialect=ansi', '--rules', 'LT01', '/tmp/tmpusayi4_z/testing.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _________________ test_cli_encoding[utf-8-command-line-False] __________________ 1684s 1684s encoding = 'utf-8', method = 'command-line', expect_success = False 1684s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_cli_encoding_utf_8_comman0') 1684s 1684s @pytest.mark.parametrize( 1684s "encoding,method,expect_success", 1684s [ 1684s ("utf-8", "command-line", False), 1684s ("utf-8-SIG", "command-line", True), 1684s ("utf-8", "config-file", False), 1684s ("utf-8-SIG", "config-file", True), 1684s ], 1684s ) 1684s def test_cli_encoding(encoding, method, expect_success, tmpdir): 1684s """Try loading a utf-8-SIG encoded file using the correct encoding via the cli.""" 1684s sql_path = "test/fixtures/cli/encoding_test.sql" 1684s if method == "command-line": 1684s options = [sql_path, "--encoding", encoding] 1684s else: 1684s assert method == "config-file" 1684s with open(str(tmpdir / ".sqlfluff"), "w") as f: 1684s print(f"[sqlfluff]\ndialect=ansi\nencoding = {encoding}", file=f) 1684s shutil.copy(sql_path, tmpdir) 1684s options = [str(tmpdir / "encoding_test.sql")] 1684s > result = invoke_assert_code( 1684s ret_code=1, 1684s args=[ 1684s lint, 1684s options, 1684s ], 1684s ) 1684s 1684s test/cli/commands_test.py:1966: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['test/fixtures/cli/encoding_test.sql', '--encoding', 'utf-8']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ________________ test_cli_encoding[utf-8-SIG-command-line-True] ________________ 1684s 1684s encoding = 'utf-8-SIG', method = 'command-line', expect_success = True 1684s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_cli_encoding_utf_8_SIG_co0') 1684s 1684s @pytest.mark.parametrize( 1684s "encoding,method,expect_success", 1684s [ 1684s ("utf-8", "command-line", False), 1684s ("utf-8-SIG", "command-line", True), 1684s ("utf-8", "config-file", False), 1684s ("utf-8-SIG", "config-file", True), 1684s ], 1684s ) 1684s def test_cli_encoding(encoding, method, expect_success, tmpdir): 1684s """Try loading a utf-8-SIG encoded file using the correct encoding via the cli.""" 1684s sql_path = "test/fixtures/cli/encoding_test.sql" 1684s if method == "command-line": 1684s options = [sql_path, "--encoding", encoding] 1684s else: 1684s assert method == "config-file" 1684s with open(str(tmpdir / ".sqlfluff"), "w") as f: 1684s print(f"[sqlfluff]\ndialect=ansi\nencoding = {encoding}", file=f) 1684s shutil.copy(sql_path, tmpdir) 1684s options = [str(tmpdir / "encoding_test.sql")] 1684s > result = invoke_assert_code( 1684s ret_code=1, 1684s args=[ 1684s lint, 1684s options, 1684s ], 1684s ) 1684s 1684s test/cli/commands_test.py:1966: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['test/fixtures/cli/encoding_test.sql', '--encoding', 'utf-8-SIG']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s __________________ test_cli_encoding[utf-8-config-file-False] __________________ 1684s 1684s encoding = 'utf-8', method = 'config-file', expect_success = False 1684s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_cli_encoding_utf_8_config0') 1684s 1684s @pytest.mark.parametrize( 1684s "encoding,method,expect_success", 1684s [ 1684s ("utf-8", "command-line", False), 1684s ("utf-8-SIG", "command-line", True), 1684s ("utf-8", "config-file", False), 1684s ("utf-8-SIG", "config-file", True), 1684s ], 1684s ) 1684s def test_cli_encoding(encoding, method, expect_success, tmpdir): 1684s """Try loading a utf-8-SIG encoded file using the correct encoding via the cli.""" 1684s sql_path = "test/fixtures/cli/encoding_test.sql" 1684s if method == "command-line": 1684s options = [sql_path, "--encoding", encoding] 1684s else: 1684s assert method == "config-file" 1684s with open(str(tmpdir / ".sqlfluff"), "w") as f: 1684s print(f"[sqlfluff]\ndialect=ansi\nencoding = {encoding}", file=f) 1684s shutil.copy(sql_path, tmpdir) 1684s options = [str(tmpdir / "encoding_test.sql")] 1684s > result = invoke_assert_code( 1684s ret_code=1, 1684s args=[ 1684s lint, 1684s options, 1684s ], 1684s ) 1684s 1684s test/cli/commands_test.py:1966: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['/tmp/pytest-of-ubuntu/pytest-0/test_cli_encoding_utf_8_config0/encoding_test.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ________________ test_cli_encoding[utf-8-SIG-config-file-True] _________________ 1684s 1684s encoding = 'utf-8-SIG', method = 'config-file', expect_success = True 1684s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_cli_encoding_utf_8_SIG_co1') 1684s 1684s @pytest.mark.parametrize( 1684s "encoding,method,expect_success", 1684s [ 1684s ("utf-8", "command-line", False), 1684s ("utf-8-SIG", "command-line", True), 1684s ("utf-8", "config-file", False), 1684s ("utf-8-SIG", "config-file", True), 1684s ], 1684s ) 1684s def test_cli_encoding(encoding, method, expect_success, tmpdir): 1684s """Try loading a utf-8-SIG encoded file using the correct encoding via the cli.""" 1684s sql_path = "test/fixtures/cli/encoding_test.sql" 1684s if method == "command-line": 1684s options = [sql_path, "--encoding", encoding] 1684s else: 1684s assert method == "config-file" 1684s with open(str(tmpdir / ".sqlfluff"), "w") as f: 1684s print(f"[sqlfluff]\ndialect=ansi\nencoding = {encoding}", file=f) 1684s shutil.copy(sql_path, tmpdir) 1684s options = [str(tmpdir / "encoding_test.sql")] 1684s > result = invoke_assert_code( 1684s ret_code=1, 1684s args=[ 1684s lint, 1684s options, 1684s ], 1684s ) 1684s 1684s test/cli/commands_test.py:1966: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['/tmp/pytest-of-ubuntu/pytest-0/test_cli_encoding_utf_8_SIG_co1/encoding_test.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ________________________ test_cli_no_disable_noqa_flag _________________________ 1684s 1684s def test_cli_no_disable_noqa_flag(): 1684s """Test that unset --disable-noqa flag respects inline noqa comments.""" 1684s > invoke_assert_code( 1684s ret_code=0, 1684s args=[ 1684s lint, 1684s ["test/fixtures/cli/disable_noqa_test.sql"], 1684s ], 1684s ) 1684s 1684s test/cli/commands_test.py:1984: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ['test/fixtures/cli/disable_noqa_test.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s __________________________ test_cli_disable_noqa_flag __________________________ 1684s 1684s def test_cli_disable_noqa_flag(): 1684s """Test that --disable-noqa flag ignores inline noqa comments.""" 1684s > invoke_assert_code( 1684s ret_code=1, 1684s args=[ 1684s lint, 1684s [ 1684s "test/fixtures/cli/disable_noqa_test.sql", 1684s "--disable-noqa", 1684s ], 1684s ], 1684s # Linting error is raised even though it is inline ignored. 1684s assert_output_contains=r"L: 6 | P: 11 | CP01 |", 1684s ) 1684s 1684s test/cli/commands_test.py:1995: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['test/fixtures/cli/disable_noqa_test.sql', '--disable-noqa']] 1684s kwargs = {}, cli_input = None, mix_stderr = True 1684s assert_output_contains = 'L: 6 | P: 11 | CP01 |', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ______________________ test_cli_disable_noqa_except_flag _______________________ 1684s 1684s def test_cli_disable_noqa_except_flag(): 1684s """Test that --disable-noqa-except flag ignores inline noqa comments.""" 1684s > result = invoke_assert_code( 1684s ret_code=1, 1684s args=[ 1684s lint, 1684s [ 1684s "test/fixtures/cli/disable_noqa_test.sql", 1684s "--disable-noqa-except", 1684s "CP01", 1684s ], 1684s ], 1684s # Linting error is raised even though it is inline ignored. 1684s assert_output_contains=r"L: 8 | P: 5 | CP03 |", 1684s ) 1684s 1684s test/cli/commands_test.py:2011: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['test/fixtures/cli/disable_noqa_test.sql', '--disable-noqa-except', 'CP01']] 1684s kwargs = {}, cli_input = None, mix_stderr = True 1684s assert_output_contains = 'L: 8 | P: 5 | CP03 |', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _________________ test_cli_disable_noqa_except_non_rules_flag __________________ 1684s 1684s def test_cli_disable_noqa_except_non_rules_flag(): 1684s """Test that --disable-noqa-except flag ignores all inline noqa comments.""" 1684s > invoke_assert_code( 1684s ret_code=1, 1684s args=[ 1684s lint, 1684s [ 1684s "test/fixtures/cli/disable_noqa_test.sql", 1684s "--disable-noqa-except", 1684s "None", 1684s ], 1684s ], 1684s # Linting error is raised even though it is inline ignored. 1684s assert_output_contains=r"L: 6 | P: 11 | CP01 |", 1684s ) 1684s 1684s test/cli/commands_test.py:2029: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['test/fixtures/cli/disable_noqa_test.sql', '--disable-noqa-except', 'None']] 1684s kwargs = {}, cli_input = None, mix_stderr = True 1684s assert_output_contains = 'L: 6 | P: 11 | CP01 |', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ________________________ test_cli_warn_unused_noqa_flag ________________________ 1684s 1684s def test_cli_warn_unused_noqa_flag(): 1684s """Test that --warn-unused-ignores flag works.""" 1684s > invoke_assert_code( 1684s # Return value should still be success. 1684s ret_code=0, 1684s args=[ 1684s lint, 1684s [ 1684s "test/fixtures/cli/disable_noqa_test.sql", 1684s "--warn-unused-ignores", 1684s ], 1684s ], 1684s # Warning shown. 1684s assert_output_contains=( 1684s r"L: 5 | P: 18 | NOQA | WARNING: Unused noqa: 'noqa: CP01'" 1684s ), 1684s ) 1684s 1684s test/cli/commands_test.py:2046: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ['test/fixtures/cli/disable_noqa_test.sql', '--warn-unused-ignores']] 1684s kwargs = {}, cli_input = None, mix_stderr = True 1684s assert_output_contains = "L: 5 | P: 18 | NOQA | WARNING: Unused noqa: 'noqa: CP01'" 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _____________ TestProgressBars.test_cli_lint_disabled_progress_bar _____________ 1684s 1684s self = 1684s mock_disable_progress_bar = 1684s 1684s def test_cli_lint_disabled_progress_bar( 1684s self, mock_disable_progress_bar: MagicMock 1684s ) -> None: 1684s """When progress bar is disabled, nothing should be printed into output.""" 1684s > result = invoke_assert_code( 1684s args=[ 1684s lint, 1684s [ 1684s "--disable-progress-bar", 1684s "test/fixtures/linter/passing.sql", 1684s ], 1684s ], 1684s ) 1684s 1684s test/cli/commands_test.py:2095: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ['--disable-progress-bar', 'test/fixtures/linter/passing.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _____________ TestProgressBars.test_cli_lint_enabled_progress_bar ______________ 1684s 1684s self = 1684s mock_disable_progress_bar = 1684s 1684s def test_cli_lint_enabled_progress_bar( 1684s self, mock_disable_progress_bar: MagicMock 1684s ) -> None: 1684s """When progress bar is enabled, there should be some tracks in output.""" 1684s > result = invoke_assert_code( 1684s args=[ 1684s lint, 1684s [ 1684s "test/fixtures/linter/passing.sql", 1684s ], 1684s ], 1684s ) 1684s 1684s test/cli/commands_test.py:2114: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0, args = [, ['test/fixtures/linter/passing.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ______ TestProgressBars.test_cli_lint_enabled_progress_bar_multiple_paths ______ 1684s 1684s self = 1684s mock_disable_progress_bar = 1684s 1684s def test_cli_lint_enabled_progress_bar_multiple_paths( 1684s self, mock_disable_progress_bar: MagicMock 1684s ) -> None: 1684s """When progress bar is enabled, there should be some tracks in output.""" 1684s > result = invoke_assert_code( 1684s ret_code=1, 1684s args=[ 1684s lint, 1684s [ 1684s "test/fixtures/linter/passing.sql", 1684s "test/fixtures/linter/indentation_errors.sql", 1684s ], 1684s ], 1684s ) 1684s 1684s test/cli/commands_test.py:2132: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['test/fixtures/linter/passing.sql', 'test/fixtures/linter/indentation_errors.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ______ TestProgressBars.test_cli_lint_enabled_progress_bar_multiple_files ______ 1684s 1684s self = 1684s mock_disable_progress_bar = 1684s 1684s def test_cli_lint_enabled_progress_bar_multiple_files( 1684s self, mock_disable_progress_bar: MagicMock 1684s ) -> None: 1684s """When progress bar is enabled, there should be some tracks in output.""" 1684s > result = invoke_assert_code( 1684s args=[ 1684s lint, 1684s [ 1684s "test/fixtures/linter/multiple_files", 1684s ], 1684s ], 1684s ) 1684s 1684s test/cli/commands_test.py:2156: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0, args = [, ['test/fixtures/linter/multiple_files']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ________________ test__cli__fix_multiple_errors_no_show_errors _________________ 1684s 1684s def test__cli__fix_multiple_errors_no_show_errors(): 1684s """Test the fix output.""" 1684s > invoke_assert_code( 1684s ret_code=1, 1684s args=[ 1684s fix, 1684s [ 1684s "--check", # Run in check mode to get the confirmation. 1684s "--disable-progress-bar", 1684s "test/fixtures/linter/multiple_sql_errors.sql", 1684s ], 1684s ], 1684s assert_output_contains=multiple_expected_output, 1684s ) 1684s 1684s test/cli/commands_test.py:2208: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['--check', '--disable-progress-bar', 'test/fixtures/linter/multiple_sql_errors.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True 1684s 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" 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s __________________ test__cli__fix_multiple_errors_quiet_force __________________ 1684s 1684s def test__cli__fix_multiple_errors_quiet_force(): 1684s """Test the fix --quiet option with --force.""" 1684s > invoke_assert_code( 1684s ret_code=0, 1684s args=[ 1684s fix, 1684s [ 1684s "--disable-progress-bar", 1684s "test/fixtures/linter/multiple_sql_errors.sql", 1684s "--quiet", 1684s "-x", 1684s "_fix", 1684s ], 1684s ], 1684s assert_output_contains=( 1684s """== [test/fixtures/linter/multiple_sql_errors.sql] FIXED 1684s 2 fixable linting violations found""" 1684s ), 1684s ) 1684s 1684s test/cli/commands_test.py:2224: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ['--disable-progress-bar', 'test/fixtures/linter/multiple_sql_errors.sql', '--quiet', '-x', '_fix']] 1684s kwargs = {}, cli_input = None, mix_stderr = True 1684s assert_output_contains = '== [test/fixtures/linter/multiple_sql_errors.sql] FIXED\n2 fixable linting violations found' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s __________________ test__cli__fix_multiple_errors_quiet_check __________________ 1684s 1684s def test__cli__fix_multiple_errors_quiet_check(): 1684s """Test the fix --quiet option without --force.""" 1684s > invoke_assert_code( 1684s ret_code=0, 1684s args=[ 1684s fix, 1684s [ 1684s "--disable-progress-bar", 1684s "test/fixtures/linter/multiple_sql_errors.sql", 1684s "--check", # Run in check mode to get the confirmation. 1684s "--quiet", 1684s "-x", 1684s "_fix", 1684s ], 1684s # Test with the confirmation step. 1684s "y", 1684s ], 1684s assert_output_contains=( 1684s """2 fixable linting violations found 1684s Are you sure you wish to attempt to fix these? [Y/n] ... 1684s == [test/fixtures/linter/multiple_sql_errors.sql] FIXED 1684s All Finished""" 1684s ), 1684s ) 1684s 1684s test/cli/commands_test.py:2245: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ['--disable-progress-bar', 'test/fixtures/linter/multiple_sql_errors.sql', '--check', '--quiet', '-x', '_fix'], 'y'] 1684s kwargs = {}, cli_input = None, mix_stderr = True 1684s 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' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s __________________ test__cli__fix_multiple_errors_show_errors __________________ 1684s 1684s def test__cli__fix_multiple_errors_show_errors(): 1684s """Test the fix --show-lint-violations option.""" 1684s > result = invoke_assert_code( 1684s ret_code=1, 1684s args=[ 1684s fix, 1684s [ 1684s "--disable-progress-bar", 1684s "--show-lint-violations", 1684s "test/fixtures/linter/multiple_sql_errors.sql", 1684s "--check", # Run in check mode to get the confirmation. 1684s ], 1684s ], 1684s ) 1684s 1684s test/cli/commands_test.py:2271: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['--disable-progress-bar', '--show-lint-violations', 'test/fixtures/linter/multiple_sql_errors.sql', '--check']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _______________________ test__cli__fix_show_parse_errors _______________________ 1684s 1684s def test__cli__fix_show_parse_errors(): 1684s """Test the fix --show-lint-violations option with parser error.""" 1684s > result = invoke_assert_code( 1684s ret_code=1, 1684s args=[ 1684s fix, 1684s [ 1684s "--show-lint-violations", 1684s "test/fixtures/linter/parse_lex_error.sql", 1684s ], 1684s ], 1684s ) 1684s 1684s test/cli/commands_test.py:2309: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['--show-lint-violations', 'test/fixtures/linter/parse_lex_error.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s __________ test__cli__multiple_files__fix_multiple_errors_show_errors __________ 1684s 1684s def test__cli__multiple_files__fix_multiple_errors_show_errors(): 1684s """Basic check of lint ensures with multiple files, filenames are listed.""" 1684s sql_path = "test/fixtures/linter/multiple_sql_errors.sql" 1684s indent_path = "test/fixtures/linter/indentation_errors.sql" 1684s > result = invoke_assert_code( 1684s ret_code=1, 1684s args=[ 1684s fix, 1684s [ 1684s "--disable-progress-bar", 1684s "--check", # Run in check mode to get the confirmation. 1684s "--show-lint-violations", 1684s sql_path, 1684s indent_path, 1684s ], 1684s ], 1684s ) 1684s 1684s test/cli/commands_test.py:2349: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1 1684s args = [, ['--disable-progress-bar', '--check', '--show-lint-violations', 'test/fixtures/linter/multiple_sql_errors.sql', 'test/fixtures/linter/indentation_errors.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True, assert_output_contains = '' 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ____________________________ test__cli__render_fail ____________________________ 1684s 1684s def test__cli__render_fail(): 1684s """Basic how render fails.""" 1684s > invoke_assert_code( 1684s ret_code=1, 1684s args=[ 1684s render, 1684s [ 1684s "test/fixtures/cli/fail_many.sql", 1684s ], 1684s ], 1684s assert_output_contains=( 1684s "L: 3 | P: 8 | TMP | Undefined jinja template " "variable: 'something'" 1684s ), 1684s ) 1684s 1684s test/cli/commands_test.py:2379: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 1, args = [, ['test/fixtures/cli/fail_many.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True 1684s assert_output_contains = "L: 3 | P: 8 | TMP | Undefined jinja template variable: 'something'" 1684s raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s ____________________________ test__cli__render_pass ____________________________ 1684s 1684s def test__cli__render_pass(): 1684s """Basic how render works.""" 1684s > invoke_assert_code( 1684s ret_code=0, 1684s args=[ 1684s render, 1684s [ 1684s "test/fixtures/templater/jinja_a/jinja.sql", 1684s ], 1684s ], 1684s assert_output_contains="SELECT 56 FROM sch1.tbl2", 1684s ) 1684s 1684s test/cli/commands_test.py:2395: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s ret_code = 0 1684s args = [, ['test/fixtures/templater/jinja_a/jinja.sql']] 1684s kwargs = {}, cli_input = None, mix_stderr = True 1684s assert_output_contains = 'SELECT 56 FROM sch1.tbl2', raise_exceptions = True 1684s 1684s def invoke_assert_code( 1684s ret_code: int = 0, 1684s args: Optional[List[Any]] = None, 1684s kwargs: Optional[Dict[str, Any]] = None, 1684s cli_input: Optional[str] = None, 1684s mix_stderr: bool = True, 1684s assert_output_contains: str = "", 1684s raise_exceptions: bool = True, 1684s ) -> Result: 1684s """Invoke a command and check return code.""" 1684s args = args or [] 1684s kwargs = kwargs or {} 1684s if cli_input: 1684s kwargs["input"] = cli_input 1684s > runner = CliRunner(mix_stderr=mix_stderr) 1684s E TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr' 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/utils/testing/cli.py:22: TypeError 1684s _______ test_diff_quality_plugin[sql_paths0-expected_violations_lines0] ________ 1684s 1684s sql_paths = ['linter/indentation_errors.sql'] 1684s expected_violations_lines = [2, 3, 4, 5, 6] 1684s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x66e5a1e5dcd0> 1684s 1684s @pytest.mark.parametrize( 1684s "sql_paths,expected_violations_lines", 1684s [ 1684s (("linter/indentation_errors.sql",), list(range(2, 7))), 1684s (("linter/parse_error.sql",), {1}), 1684s # NB: This version of the file is in a directory configured 1684s # to ignore parsing errors. 1684s (("linter/diffquality/parse_error.sql",), []), 1684s (tuple(), []), 1684s ], 1684s ) 1684s def test_diff_quality_plugin(sql_paths, expected_violations_lines, monkeypatch): 1684s """Test the plugin at least finds errors on the expected lines.""" 1684s 1684s def execute(command, exit_codes): 1684s printable_command_parts = [ 1684s c.decode(sys.getfilesystemencoding()) if isinstance(c, bytes) else c 1684s for c in command 1684s ] 1684s 1684s result = invoke_assert_code( 1684s ret_code=1 if expected_violations_lines else 0, 1684s args=[ 1684s lint, 1684s printable_command_parts[2:], 1684s ], 1684s ) 1684s return result.output, "" 1684s 1684s # Mock the execute function -- this is an attempt to prevent the CircleCI 1684s # coverage check from hanging. (We've seen issues in the past where using 1684s # subprocesses caused things to occasionally hang.) 1684s monkeypatch.setattr(diff_quality_plugin, "execute", execute) 1684s monkeypatch.chdir("test/fixtures/") 1684s violation_reporter = diff_quality_plugin.diff_cover_report_quality( 1684s options="--processes=1" 1684s ) 1684s assert len(sql_paths) in (0, 1) 1684s sql_paths = [str(Path(sql_path)) for sql_path in sql_paths] 1684s 1684s > violations_dict = violation_reporter.violations_batch(sql_paths) 1684s 1684s /tmp/autopkgtest.oASYaB/autopkgtest_tmp/test/diff_quality_plugin_test.py:53: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s self = 1684s src_paths = ['linter/indentation_errors.sql'] 1684s 1684s def violations_batch(self, src_paths): 1684s """Return a dictionary of Violations recorded in `src_paths`.""" 1684s # Check if SQLFluff is installed. 1684s if self.driver_tool_installed is None: 1684s self.driver_tool_installed = self.driver.installed() 1684s if not self.driver_tool_installed: # pragma: no cover 1684s > raise OSError(f"{self.driver.name} is not installed") 1684s E OSError: ['/usr/bin/python3.12', '-m', 'sqlfluff.cli.commands'] is not installed 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/diff_quality_plugin.py:61: OSError 1684s _______ test_diff_quality_plugin[sql_paths1-expected_violations_lines1] ________ 1684s 1684s sql_paths = ['linter/parse_error.sql'], expected_violations_lines = {1} 1684s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x66e5a1e5c5c0> 1684s 1684s @pytest.mark.parametrize( 1684s "sql_paths,expected_violations_lines", 1684s [ 1684s (("linter/indentation_errors.sql",), list(range(2, 7))), 1684s (("linter/parse_error.sql",), {1}), 1684s # NB: This version of the file is in a directory configured 1684s # to ignore parsing errors. 1684s (("linter/diffquality/parse_error.sql",), []), 1684s (tuple(), []), 1684s ], 1684s ) 1684s def test_diff_quality_plugin(sql_paths, expected_violations_lines, monkeypatch): 1684s """Test the plugin at least finds errors on the expected lines.""" 1684s 1684s def execute(command, exit_codes): 1684s printable_command_parts = [ 1684s c.decode(sys.getfilesystemencoding()) if isinstance(c, bytes) else c 1684s for c in command 1684s ] 1684s 1684s result = invoke_assert_code( 1684s ret_code=1 if expected_violations_lines else 0, 1684s args=[ 1684s lint, 1684s printable_command_parts[2:], 1684s ], 1684s ) 1684s return result.output, "" 1684s 1684s # Mock the execute function -- this is an attempt to prevent the CircleCI 1684s # coverage check from hanging. (We've seen issues in the past where using 1684s # subprocesses caused things to occasionally hang.) 1684s monkeypatch.setattr(diff_quality_plugin, "execute", execute) 1684s monkeypatch.chdir("test/fixtures/") 1684s violation_reporter = diff_quality_plugin.diff_cover_report_quality( 1684s options="--processes=1" 1684s ) 1684s assert len(sql_paths) in (0, 1) 1684s sql_paths = [str(Path(sql_path)) for sql_path in sql_paths] 1684s 1684s > violations_dict = violation_reporter.violations_batch(sql_paths) 1684s 1684s /tmp/autopkgtest.oASYaB/autopkgtest_tmp/test/diff_quality_plugin_test.py:53: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s self = 1684s src_paths = ['linter/parse_error.sql'] 1684s 1684s def violations_batch(self, src_paths): 1684s """Return a dictionary of Violations recorded in `src_paths`.""" 1684s # Check if SQLFluff is installed. 1684s if self.driver_tool_installed is None: 1684s self.driver_tool_installed = self.driver.installed() 1684s if not self.driver_tool_installed: # pragma: no cover 1684s > raise OSError(f"{self.driver.name} is not installed") 1684s E OSError: ['/usr/bin/python3.12', '-m', 'sqlfluff.cli.commands'] is not installed 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/diff_quality_plugin.py:61: OSError 1684s _______ test_diff_quality_plugin[sql_paths2-expected_violations_lines2] ________ 1684s 1684s sql_paths = ['linter/diffquality/parse_error.sql'] 1684s expected_violations_lines = [] 1684s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x66e5910b33b0> 1684s 1684s @pytest.mark.parametrize( 1684s "sql_paths,expected_violations_lines", 1684s [ 1684s (("linter/indentation_errors.sql",), list(range(2, 7))), 1684s (("linter/parse_error.sql",), {1}), 1684s # NB: This version of the file is in a directory configured 1684s # to ignore parsing errors. 1684s (("linter/diffquality/parse_error.sql",), []), 1684s (tuple(), []), 1684s ], 1684s ) 1684s def test_diff_quality_plugin(sql_paths, expected_violations_lines, monkeypatch): 1684s """Test the plugin at least finds errors on the expected lines.""" 1684s 1684s def execute(command, exit_codes): 1684s printable_command_parts = [ 1684s c.decode(sys.getfilesystemencoding()) if isinstance(c, bytes) else c 1684s for c in command 1684s ] 1684s 1684s result = invoke_assert_code( 1684s ret_code=1 if expected_violations_lines else 0, 1684s args=[ 1684s lint, 1684s printable_command_parts[2:], 1684s ], 1684s ) 1684s return result.output, "" 1684s 1684s # Mock the execute function -- this is an attempt to prevent the CircleCI 1684s # coverage check from hanging. (We've seen issues in the past where using 1684s # subprocesses caused things to occasionally hang.) 1684s monkeypatch.setattr(diff_quality_plugin, "execute", execute) 1684s monkeypatch.chdir("test/fixtures/") 1684s violation_reporter = diff_quality_plugin.diff_cover_report_quality( 1684s options="--processes=1" 1684s ) 1684s assert len(sql_paths) in (0, 1) 1684s sql_paths = [str(Path(sql_path)) for sql_path in sql_paths] 1684s 1684s > violations_dict = violation_reporter.violations_batch(sql_paths) 1684s 1684s /tmp/autopkgtest.oASYaB/autopkgtest_tmp/test/diff_quality_plugin_test.py:53: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s self = 1684s src_paths = ['linter/diffquality/parse_error.sql'] 1684s 1684s def violations_batch(self, src_paths): 1684s """Return a dictionary of Violations recorded in `src_paths`.""" 1684s # Check if SQLFluff is installed. 1684s if self.driver_tool_installed is None: 1684s self.driver_tool_installed = self.driver.installed() 1684s if not self.driver_tool_installed: # pragma: no cover 1684s > raise OSError(f"{self.driver.name} is not installed") 1684s E OSError: ['/usr/bin/python3.12', '-m', 'sqlfluff.cli.commands'] is not installed 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/diff_quality_plugin.py:61: OSError 1684s _______ test_diff_quality_plugin[sql_paths3-expected_violations_lines3] ________ 1684s 1684s sql_paths = [], expected_violations_lines = [] 1684s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x66e5910b2090> 1684s 1684s @pytest.mark.parametrize( 1684s "sql_paths,expected_violations_lines", 1684s [ 1684s (("linter/indentation_errors.sql",), list(range(2, 7))), 1684s (("linter/parse_error.sql",), {1}), 1684s # NB: This version of the file is in a directory configured 1684s # to ignore parsing errors. 1684s (("linter/diffquality/parse_error.sql",), []), 1684s (tuple(), []), 1684s ], 1684s ) 1684s def test_diff_quality_plugin(sql_paths, expected_violations_lines, monkeypatch): 1684s """Test the plugin at least finds errors on the expected lines.""" 1684s 1684s def execute(command, exit_codes): 1684s printable_command_parts = [ 1684s c.decode(sys.getfilesystemencoding()) if isinstance(c, bytes) else c 1684s for c in command 1684s ] 1684s 1684s result = invoke_assert_code( 1684s ret_code=1 if expected_violations_lines else 0, 1684s args=[ 1684s lint, 1684s printable_command_parts[2:], 1684s ], 1684s ) 1684s return result.output, "" 1684s 1684s # Mock the execute function -- this is an attempt to prevent the CircleCI 1684s # coverage check from hanging. (We've seen issues in the past where using 1684s # subprocesses caused things to occasionally hang.) 1684s monkeypatch.setattr(diff_quality_plugin, "execute", execute) 1684s monkeypatch.chdir("test/fixtures/") 1684s violation_reporter = diff_quality_plugin.diff_cover_report_quality( 1684s options="--processes=1" 1684s ) 1684s assert len(sql_paths) in (0, 1) 1684s sql_paths = [str(Path(sql_path)) for sql_path in sql_paths] 1684s 1684s > violations_dict = violation_reporter.violations_batch(sql_paths) 1684s 1684s /tmp/autopkgtest.oASYaB/autopkgtest_tmp/test/diff_quality_plugin_test.py:53: 1684s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1684s 1684s self = 1684s src_paths = [] 1684s 1684s def violations_batch(self, src_paths): 1684s """Return a dictionary of Violations recorded in `src_paths`.""" 1684s # Check if SQLFluff is installed. 1684s if self.driver_tool_installed is None: 1684s self.driver_tool_installed = self.driver.installed() 1684s if not self.driver_tool_installed: # pragma: no cover 1684s > raise OSError(f"{self.driver.name} is not installed") 1684s E OSError: ['/usr/bin/python3.12', '-m', 'sqlfluff.cli.commands'] is not installed 1684s 1684s /usr/lib/python3/dist-packages/sqlfluff/diff_quality_plugin.py:61: OSError 1684s =========================== short test summary info ============================ 1684s FAILED test/cli/commands_test.py::test__cli__command_directed - TypeError: Cl... 1684s FAILED test/cli/commands_test.py::test__cli__command_dialect - TypeError: Cli... 1684s FAILED test/cli/commands_test.py::test__cli__command_no_dialect[command0] - T... 1684s FAILED test/cli/commands_test.py::test__cli__command_no_dialect[command1] - T... 1684s FAILED test/cli/commands_test.py::test__cli__command_no_dialect[command2] - T... 1684s FAILED test/cli/commands_test.py::test__cli__command_no_dialect[command3] - T... 1684s FAILED test/cli/commands_test.py::test__cli__command_no_dialect[command4] - T... 1684s FAILED test/cli/commands_test.py::test__cli__command_parse_error_dialect_explicit_warning 1684s FAILED test/cli/commands_test.py::test__cli__command_parse_error_dialect_implicit_warning 1684s FAILED test/cli/commands_test.py::test__cli__command_dialect_legacy - TypeErr... 1684s FAILED test/cli/commands_test.py::test__cli__command_extra_config_fail - Type... 1684s 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'] 1684s 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'.] 1684s FAILED test/cli/commands_test.py::test__cli__command_stdin_filename_config[command2-test/fixtures/cli/stdin_filename/stdin_filename.sql-0-All Finished!] 1684s 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!] 1684s 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'.] 1684s 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] 1684s 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] 1684s 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]] 1684s 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] 1684s 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] 1684s FAILED test/cli/commands_test.py::test__cli__command_stdin_filename_config[command10-test/fixtures/an_ansi_config_here.sql-1-Unfixable violations detected.] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_stdin[command0] - T... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_stdin[command1] - T... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_stdin[command2] - T... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_stdin[command3] - T... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_empty_stdin - TypeE... 1684s FAILED test/cli/commands_test.py::test__cli__command_render_stdin - TypeError... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command0] - T... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command1] - T... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command2] - T... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command3] - T... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command4] - T... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command5] - T... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command6] - T... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command7] - T... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command8] - T... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command9] - T... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command10] - ... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command11] - ... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command12] - ... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command13] - ... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command14] - ... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command15] - ... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command16] - ... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command17] - ... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command18] - ... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command19] - ... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command20] - ... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command21] - ... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command22] - ... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command23] - ... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command24] - ... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command25] - ... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command26] - ... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command27] - ... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command28] - ... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse[command29] - ... 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command0-1] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command1-1] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command2-1] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command3-0] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command4-0] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command5-2] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command6-1] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command7-0] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command8-1] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command9-1] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command10-1] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command11-2] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command12-1] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command13-1] 1684s FAILED test/cli/commands_test.py::test__cli__command_rules - TypeError: CliRu... 1684s FAILED test/cli/commands_test.py::test__cli__command_dialects - TypeError: Cl... 1684s FAILED test/cli/commands_test.py::test__cli__command__fix[LT01-test/fixtures/linter/indentation_errors.sql0] 1684s FAILED test/cli/commands_test.py::test__cli__command__fix[LT01-test/fixtures/linter/whitespace_errors.sql] 1684s FAILED test/cli/commands_test.py::test__cli__command__fix[LT01-test/fixtures/linter/indentation_errors.sql1] 1684s FAILED test/cli/commands_test.py::test__cli__command__fix[LT02-test/fixtures/linter/indentation_error_hard.sql] 1684s FAILED test/cli/commands_test.py::test_cli_fix_even_unparsable[command-line-False] 1684s FAILED test/cli/commands_test.py::test_cli_fix_even_unparsable[command-line-True] 1684s FAILED test/cli/commands_test.py::test_cli_fix_even_unparsable[config-file-False] 1684s FAILED test/cli/commands_test.py::test_cli_fix_even_unparsable[config-file-True] 1684s FAILED test/cli/commands_test.py::test__cli__command_fix_stdin[select * from t-LT02-select * from t] 1684s FAILED test/cli/commands_test.py::test__cli__command_fix_stdin[ select * from t-LT02-select * from t] 1684s FAILED test/cli/commands_test.py::test__cli__command_format_stdin[select * from t\n-select * from t\n] 1684s FAILED test/cli/commands_test.py::test__cli__command_format_stdin[ select * FRoM t -select * from t\n] 1684s 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] 1684s FAILED test/cli/commands_test.py::test__cli__command_fix_stdin_logging_to_stderr 1684s FAILED test/cli/commands_test.py::test__cli__command_fix_stdin_safety - TypeE... 1684s 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.] 1684s FAILED test/cli/commands_test.py::test__cli__command_fix_stdin_error_exit_code[create TABLE a.t (a int)-0--] 1684s FAILED test/cli/commands_test.py::test__cli__command_fix_stdin_error_exit_code[create table a.t (a int)-0--] 1684s 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.] 1684s FAILED test/cli/commands_test.py::test__cli__command__fix_check[LT01-test/fixtures/linter/indentation_errors.sql-y-0-0] 1684s FAILED test/cli/commands_test.py::test__cli__command__fix_check[LT01-test/fixtures/linter/indentation_errors.sql-n-1-1] 1684s FAILED test/cli/commands_test.py::test__cli__command_parse_serialize_from_stdin[None-yaml] 1684s FAILED test/cli/commands_test.py::test__cli__command_parse_serialize_from_stdin[None-json] 1684s FAILED test/cli/commands_test.py::test__cli__command_parse_serialize_from_stdin[outfile-yaml] 1684s FAILED test/cli/commands_test.py::test__cli__command_parse_serialize_from_stdin[outfile-json] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_from_stdin[select * from tbl-CP01-expected0-0-yaml] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_from_stdin[select * from tbl-CP01-expected0-0-json] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_from_stdin[select * from tbl-CP01-expected0-0-none] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_from_stdin[SElect * from tbl-CP01-expected1-1-yaml] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_from_stdin[SElect * from tbl-CP01-expected1-1-json] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_from_stdin[SElect * from tbl-CP01-expected1-1-none] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_from_stdin[SELECT {{1}}-JJ01-expected2-1-yaml] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_from_stdin[SELECT {{1}}-JJ01-expected2-1-json] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_from_stdin[SELECT {{1}}-JJ01-expected2-1-none] 1684s FAILED test/cli/commands_test.py::test__cli__command_fail_nice_not_found[command0] 1684s FAILED test/cli/commands_test.py::test__cli__command_fail_nice_not_found[command1] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[None-human] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[None-yaml] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[None-json] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[None-github-annotation] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[None-github-annotation-native] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[None-none] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[outfile-human] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[outfile-yaml] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[outfile-json] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[outfile-github-annotation] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[outfile-github-annotation-native] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[outfile-none] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_github_annotation 1684s 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] 1684s 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] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_annotation_level_error_failure_equivalent[github-annotation] 1684s FAILED test/cli/commands_test.py::test__cli__command_lint_serialize_annotation_level_error_failure_equivalent[github-annotation-native] 1684s FAILED test/cli/commands_test.py::test_encoding[utf-8-ascii] - TypeError: Cli... 1684s FAILED test/cli/commands_test.py::test_encoding[utf-8-sig-UTF-8-SIG] - TypeEr... 1684s FAILED test/cli/commands_test.py::test_encoding[utf-32-UTF-32] - TypeError: C... 1684s FAILED test/cli/commands_test.py::test_cli_encoding[utf-8-command-line-False] 1684s FAILED test/cli/commands_test.py::test_cli_encoding[utf-8-SIG-command-line-True] 1684s FAILED test/cli/commands_test.py::test_cli_encoding[utf-8-config-file-False] 1684s FAILED test/cli/commands_test.py::test_cli_encoding[utf-8-SIG-config-file-True] 1684s FAILED test/cli/commands_test.py::test_cli_no_disable_noqa_flag - TypeError: ... 1684s FAILED test/cli/commands_test.py::test_cli_disable_noqa_flag - TypeError: Cli... 1684s FAILED test/cli/commands_test.py::test_cli_disable_noqa_except_flag - TypeErr... 1684s FAILED test/cli/commands_test.py::test_cli_disable_noqa_except_non_rules_flag 1684s FAILED test/cli/commands_test.py::test_cli_warn_unused_noqa_flag - TypeError:... 1684s FAILED test/cli/commands_test.py::TestProgressBars::test_cli_lint_disabled_progress_bar 1684s FAILED test/cli/commands_test.py::TestProgressBars::test_cli_lint_enabled_progress_bar 1684s FAILED test/cli/commands_test.py::TestProgressBars::test_cli_lint_enabled_progress_bar_multiple_paths 1684s FAILED test/cli/commands_test.py::TestProgressBars::test_cli_lint_enabled_progress_bar_multiple_files 1684s FAILED test/cli/commands_test.py::test__cli__fix_multiple_errors_no_show_errors 1684s FAILED test/cli/commands_test.py::test__cli__fix_multiple_errors_quiet_force 1684s FAILED test/cli/commands_test.py::test__cli__fix_multiple_errors_quiet_check 1684s FAILED test/cli/commands_test.py::test__cli__fix_multiple_errors_show_errors 1684s FAILED test/cli/commands_test.py::test__cli__fix_show_parse_errors - TypeErro... 1684s FAILED test/cli/commands_test.py::test__cli__multiple_files__fix_multiple_errors_show_errors 1684s FAILED test/cli/commands_test.py::test__cli__render_fail - TypeError: CliRunn... 1684s FAILED test/cli/commands_test.py::test__cli__render_pass - TypeError: CliRunn... 1684s FAILED test/diff_quality_plugin_test.py::test_diff_quality_plugin[sql_paths0-expected_violations_lines0] 1684s FAILED test/diff_quality_plugin_test.py::test_diff_quality_plugin[sql_paths1-expected_violations_lines1] 1684s FAILED test/diff_quality_plugin_test.py::test_diff_quality_plugin[sql_paths2-expected_violations_lines2] 1684s FAILED test/diff_quality_plugin_test.py::test_diff_quality_plugin[sql_paths3-expected_violations_lines3] 1684s ==== 155 failed, 8364 passed, 1 skipped, 1 deselected in 1544.64s (0:25:44) ==== 1685s autopkgtest [07:27:04]: test upstream: -----------------------] 1686s upstream FAIL non-zero exit status 1 1686s autopkgtest [07:27:05]: test upstream: - - - - - - - - - - results - - - - - - - - - - 1686s autopkgtest [07:27:05]: @@@@@@@@@@@@@@@@@@@@ summary 1686s upstream FAIL non-zero exit status 1 1703s nova [W] Using flock in prodstack6-ppc64el 1703s Creating nova instance adt-plucky-ppc64el-sqlfluff-20250219-065859-juju-7f2275-prod-proposed-migration-environment-15-6b0ed0cb-ae0b-4912-9fae-d99614d37688 from image adt/ubuntu-plucky-ppc64el-server-20250218.img (UUID 9318aa34-3d3c-43c5-86d2-aaf9390f2f5d)... 1703s nova [W] Timed out waiting for 7ffcb5c5-eb0f-4de1-942c-5be0c4c7b602 to get deleted.