Fix invalid auto_int value error when --umask=0 passed (#1632)

Fixes #1622
This commit is contained in:
Hasan Ramezani 2017-10-28 11:18:23 +03:30 committed by Berker Peksag
parent a3e258f24a
commit 90b7daebb6
2 changed files with 5 additions and 3 deletions

View File

@ -43,8 +43,8 @@ def make_settings(ignore=None):
def auto_int(_, x):
if x.startswith('0') and not x.lower().startswith('0x'):
# for compatible with octal numbers in python3
# for compatible with octal numbers in python3
if re.match(r'0(\d)', x, re.IGNORECASE):
x = x.replace('0', '0o', 1)
return int(x, 0)

View File

@ -374,7 +374,9 @@ def test_reload(options, expected):
@pytest.mark.parametrize("options, expected", [
(["--umask 0", "myapp:app"], 0),
(["--umask", "0", "myapp:app"], 0),
(["--umask", "0o0", "myapp:app"], 0),
(["--umask", "0x0", "myapp:app"], 0),
(["--umask", "0xFF", "myapp:app"], 255),
(["--umask", "0022", "myapp:app"], 18),
])