Skip to content

Commit

Permalink
Drop support for python 3.7, add python 3.12-dev (#449)
Browse files Browse the repository at this point in the history
* fixes for sh 2.*

* Drop support for python 3.7

* Add python 3.12 alpha
  • Loading branch information
theskumar committed Feb 24, 2023
1 parent 87e5527 commit 0611643
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
matrix:
os:
- ubuntu-latest
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", pypy3.9]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12-dev", pypy3.9]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ flake8>=2.2.3
ipython
pytest-cov
pytest>=3.9
sh>=1.09
sh>=2
tox
twine
wheel
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def read_files(files):
package_data={
'dotenv': ['py.typed'],
},
python_requires=">=3.7",
python_requires=">=3.8",
extras_require={
'cli': ['click>=5.0', ],
},
Expand All @@ -45,11 +45,11 @@ def read_files(files):
'Development Status :: 5 - Production/Stable',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: Implementation :: PyPy',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
Expand Down
66 changes: 33 additions & 33 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,61 +153,61 @@ def test_set_no_file(cli):


def test_get_default_path(tmp_path):
sh.cd(str(tmp_path))
with open(str(tmp_path / ".env"), "w") as f:
f.write("a=b")
with sh.pushd(str(tmp_path)):
with open(str(tmp_path / ".env"), "w") as f:
f.write("a=b")

result = sh.dotenv("get", "a")
result = sh.dotenv("get", "a")

assert result == "b\n"
assert result == "b\n"


def test_run(tmp_path):
sh.cd(str(tmp_path))
dotenv_file = str(tmp_path / ".env")
with open(dotenv_file, "w") as f:
f.write("a=b")
with sh.pushd(str(tmp_path)):
dotenv_file = str(tmp_path / ".env")
with open(dotenv_file, "w") as f:
f.write("a=b")

result = sh.dotenv("run", "printenv", "a")
result = sh.dotenv("run", "printenv", "a")

assert result == "b\n"
assert result == "b\n"


def test_run_with_existing_variable(tmp_path):
sh.cd(str(tmp_path))
dotenv_file = str(tmp_path / ".env")
with open(dotenv_file, "w") as f:
f.write("a=b")
env = dict(os.environ)
env.update({"LANG": "en_US.UTF-8", "a": "c"})
with sh.pushd(str(tmp_path)):
dotenv_file = str(tmp_path / ".env")
with open(dotenv_file, "w") as f:
f.write("a=b")
env = dict(os.environ)
env.update({"LANG": "en_US.UTF-8", "a": "c"})

result = sh.dotenv("run", "printenv", "a", _env=env)
result = sh.dotenv("run", "printenv", "a", _env=env)

assert result == "b\n"
assert result == "b\n"


def test_run_with_existing_variable_not_overridden(tmp_path):
sh.cd(str(tmp_path))
dotenv_file = str(tmp_path / ".env")
with open(dotenv_file, "w") as f:
f.write("a=b")
env = dict(os.environ)
env.update({"LANG": "en_US.UTF-8", "a": "c"})
with sh.pushd(str(tmp_path)):
dotenv_file = str(tmp_path / ".env")
with open(dotenv_file, "w") as f:
f.write("a=b")
env = dict(os.environ)
env.update({"LANG": "en_US.UTF-8", "a": "c"})

result = sh.dotenv("run", "--no-override", "printenv", "a", _env=env)
result = sh.dotenv("run", "--no-override", "printenv", "a", _env=env)

assert result == "c\n"
assert result == "c\n"


def test_run_with_none_value(tmp_path):
sh.cd(str(tmp_path))
dotenv_file = str(tmp_path / ".env")
with open(dotenv_file, "w") as f:
f.write("a=b\nc")
with sh.pushd(str(tmp_path)):
dotenv_file = str(tmp_path / ".env")
with open(dotenv_file, "w") as f:
f.write("a=b\nc")

result = sh.dotenv("run", "printenv", "a")
result = sh.dotenv("run", "printenv", "a")

assert result == "b\n"
assert result == "b\n"


def test_run_with_other_env(dotenv_file):
Expand Down
14 changes: 7 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
[tox]
envlist = lint,py{37,38,39,310,311},pypy3,manifest,coverage-report
envlist = lint,py{38,39,310,311,312-dev},pypy3,manifest,coverage-report

[gh-actions]
python =
3.7: py37
3.8: py38
3.9: py39
3.10: py310
3.11: py311, lint, manifest
3.12-dev: py312-dev
pypy-3.9: pypy3

[testenv]
deps =
pytest
pytest-cov
sh
sh >= 2.0.2, <3
click
py{37,38,39,310,311,pypy3}: ipython
py{38,39,310,311,py312-dev,pypy3}: ipython
commands = pytest --cov --cov-report=term-missing --cov-config setup.cfg {posargs}
depends =
py{37,38,39,310,311},pypy3: coverage-clean
coverage-report: py{35,36,37,38,39,310,311},pypy3
py{38,39,310,311,312-dev},pypy3: coverage-clean
coverage-report: py{38,39,310,311,312-dev},pypy3

[testenv:lint]
skip_install = true
Expand All @@ -29,11 +29,11 @@ deps =
mypy
commands =
flake8 src tests
mypy --python-version=3.12 src tests
mypy --python-version=3.11 src tests
mypy --python-version=3.10 src tests
mypy --python-version=3.9 src tests
mypy --python-version=3.8 src tests
mypy --python-version=3.7 src tests

[testenv:manifest]
deps = check-manifest
Expand Down

0 comments on commit 0611643

Please sign in to comment.