summaryrefslogtreecommitdiff
path: root/tests/test_cli.py
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2020-05-24 06:44:09 -0700
committerJon Dufresne <jon.dufresne@gmail.com>2020-08-31 17:27:38 -0700
commit3e3892f939031d58d98275ce8a237689225d299a (patch)
tree93b64d7fd8aa1cc19335db11c915dfc59376eae9 /tests/test_cli.py
parent28a2acdd9b307c95d2111f1f831b1a5afc634691 (diff)
downloadsqlparse-3e3892f939031d58d98275ce8a237689225d299a.tar.gz
Remove support for end-of-life Pythons
Python 2.7 and 3.4 are end-of-life. They are no longer receiving bug fixes, including for security issues. Python 2.7 went EOL on 2020-01-01 and 3.4 on 2019-03-18. For additional details on support Python versions, see: Supported: https://devguide.python.org/#status-of-python-branches EOL: https://devguide.python.org/devcycle/#end-of-life-branches Removing support for EOL Pythons will reduce testing and maintenance resources while allowing the library to move towards modern Python 3. Using pypinfo, we can show the PyPI download statistics, showing less than 10% of users are using Python 2.7. | python_version | percent | download_count | | -------------- | ------: | -------------: | | 3.7 | 45.36% | 3,056,010 | | 3.6 | 26.46% | 1,782,778 | | 3.8 | 12.22% | 823,213 | | 2.7 | 9.97% | 671,459 | | 3.5 | 5.86% | 394,846 | | 3.4 | 0.10% | 6,700 | | 3.9 | 0.03% | 2,346 | | 2.6 | 0.00% | 57 | | 3.3 | 0.00% | 21 | | 3.10 | 0.00% | 6 | | Total | | 6,737,436 | Library users who continue to use Python 2.7 will still be able to install previous versions of sqlparse. Compatibility shims have been dropped, simplifying the code. Using pyupgrade, the codebase has been updated to take advantage of modern syntax <https://github.com/asottile/pyupgrade>. The wheel is no longer marked as "universal" as it is now Python 3 only.
Diffstat (limited to 'tests/test_cli.py')
-rw-r--r--tests/test_cli.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 5f1ea0e..746b632 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -1,5 +1,3 @@
-# -*- coding: utf-8 -*-
-
import subprocess
import sys
@@ -71,7 +69,7 @@ def test_stdout(filepath, load_file, capsys):
def test_script():
# Call with the --help option as a basic sanity check.
- cmd = "{0:s} -m sqlparse.cli --help".format(sys.executable)
+ cmd = "{:s} -m sqlparse.cli --help".format(sys.executable)
assert subprocess.call(cmd.split()) == 0
@@ -115,7 +113,7 @@ def test_encoding_stdin_utf8(filepath, load_file, capfd):
path = filepath('encoding_utf8.sql')
expected = load_file('encoding_utf8.sql', 'utf-8')
old_stdin = sys.stdin
- with open(path, 'r') as f:
+ with open(path) as f:
sys.stdin = f
sys.stdout.encoding = 'utf-8'
sqlparse.cli.main(['-'])
@@ -128,7 +126,7 @@ def test_encoding_stdin_gbk(filepath, load_file, capfd):
path = filepath('encoding_gbk.sql')
expected = load_file('encoding_gbk.sql', 'gbk')
old_stdin = sys.stdin
- with open(path, 'r') as stream:
+ with open(path) as stream:
sys.stdin = stream
sys.stdout.encoding = 'gbk'
sqlparse.cli.main(['-', '--encoding', 'gbk'])
@@ -139,7 +137,7 @@ def test_encoding_stdin_gbk(filepath, load_file, capfd):
def test_encoding(filepath, capsys):
path = filepath('test_cp1251.sql')
- expected = u'insert into foo values (1); -- Песня про надежду\n'
+ expected = 'insert into foo values (1); -- Песня про надежду\n'
sqlparse.cli.main([path, '--encoding=cp1251'])
out, _ = capsys.readouterr()
assert out == expected