Skip to content

Commit 9e1eb06

Browse files
authored
Merge pull request #61 from ushiboy/release/1.1.2
[WIP] Release 1.1.2
2 parents 0446617 + 054e1a7 commit 9e1eb06

4 files changed

Lines changed: 12 additions & 5 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,10 @@ nmcli.set_lang(lang: str) -> None
459459

460460
## Change Log
461461

462+
### 1.1.2
463+
464+
- Fixed a problem with environment variables being scraped.
465+
462466
### 1.1.1
463467

464468
- Include LICENSE.txt in the tar.

nmcli/_system.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
from subprocess import CalledProcessError, run
23
from typing import List, Union
34

@@ -38,8 +39,9 @@ def nmcli(self, parameters: CommandParameter) -> str:
3839
c = ['sudo', 'nmcli'] if self._use_sudo else ['nmcli']
3940
commands = c + parameters
4041
try:
42+
env = dict(os.environ, **{'LANG': self._lang})
4143
r = self._run(commands, capture_output=True,
42-
check=True, env={'LANG': self._lang})
44+
check=True, env=env)
4345
return r.stdout.decode('utf-8')
4446
except CalledProcessError as e:
4547
rc = e.returncode

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def run_tests(self):
1313

1414
setup(
1515
name='nmcli',
16-
version='1.1.1',
16+
version='1.1.2',
1717
author='ushiboy',
1818
license='MIT',
1919
license_files = ('LICENSE.txt',),

tests/test_system.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# pylint: disable=line-too-long
2+
import os
23
from subprocess import CalledProcessError, CompletedProcess
34

45
import pytest
@@ -44,15 +45,15 @@ def test_nmcli_when_successed():
4445
s = SystemCommand(run)
4546
assert s.nmcli('connection') == 'test'
4647
assert run.passed_args == ['sudo', 'nmcli', 'connection']
47-
assert run.passed_env == {'LANG': 'C'}
48+
assert run.passed_env == dict(os.environ, **{'LANG': 'C'})
4849

4950

5051
def test_nmcli_when_successed_with_list_args():
5152
run = DummySubprocessRunner(stdout=b'test')
5253
s = SystemCommand(run)
5354
assert s.nmcli(['device', 'wifi']) == 'test'
5455
assert run.passed_args == ['sudo', 'nmcli', 'device', 'wifi']
55-
assert run.passed_env == {'LANG': 'C'}
56+
assert run.passed_env == dict(os.environ, **{'LANG': 'C'})
5657

5758

5859
def test_nmcli_when_failed_with_invalid_user_input():
@@ -152,4 +153,4 @@ def test_set_lang():
152153
s.set_lang('C.UTF-8')
153154
assert s.nmcli('connection') == 'test'
154155
assert run.passed_args == ['sudo', 'nmcli', 'connection']
155-
assert run.passed_env == {'LANG': 'C.UTF-8'}
156+
assert run.passed_env == dict(os.environ, **{'LANG': 'C.UTF-8'})

0 commit comments

Comments
 (0)