Skip to content

Commit 51bb2e0

Browse files
Fix #124
2 parents a3f3081 + 414acaa commit 51bb2e0

File tree

3 files changed

+69
-1
lines changed

3 files changed

+69
-1
lines changed

.github/workflows/main.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
##
2+
# A GitHub Action to run Tox
3+
4+
name: Tox
5+
6+
# Controls when the action will run.
7+
on:
8+
# Triggers the workflow on push or pull request events but only for the master branch
9+
pull_request:
10+
branches:
11+
- master
12+
push:
13+
branches:
14+
- master
15+
- tox-action
16+
17+
# Allows you to run this workflow manually from the Actions tab
18+
workflow_dispatch:
19+
20+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
21+
jobs:
22+
# This workflow contains a single job called "build"
23+
py37:
24+
runs-on: ubuntu-latest
25+
container: python:3.7-alpine
26+
27+
# Steps represent a sequence of tasks that will be executed as part of the job
28+
steps:
29+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
30+
- uses: actions/checkout@v2
31+
32+
# Runs a single command using the runners shell
33+
- name: Install Tox
34+
run: pip install --user --upgrade tox
35+
36+
- name: Run Tox
37+
env:
38+
TOXENV: py37
39+
run: |
40+
"$HOME/.local/bin/tox"
41+
42+
py27:
43+
runs-on: ubuntu-latest
44+
container: python:2.7-alpine
45+
46+
# Steps represent a sequence of tasks that will be executed as part of the job
47+
steps:
48+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
49+
- uses: actions/checkout@v2
50+
51+
# Runs a single command using the runners shell
52+
- name: Install Tox
53+
run: pip install --user --upgrade tox
54+
55+
- name: Run Tox
56+
env:
57+
TOXENV: py27
58+
run: |
59+
"$HOME/.local/bin/tox"
60+

decouple.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def __init__(self, source, encoding=DEFAULT_ENCODING):
136136
k = k.strip()
137137
v = v.strip()
138138
if len(v) >= 2 and ((v[0] == "'" and v[-1] == "'") or (v[0] == '"' and v[-1] == '"')):
139-
v = v.strip('\'"')
139+
v = v[1:-1]
140140
self.data[k] = v
141141

142142
def __contains__(self, key):

tests/test_env.py

+8
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@
4545
KeyWithDoubleQuoteBegin="text
4646
KeyIsSingleQuote='
4747
KeyIsDoubleQuote="
48+
KeyHasTwoSingleQuote="'Y'"
49+
KeyHasTwoDoubleQuote='"Y"'
50+
KeyHasMixedQuotesAsData1="Y'
51+
KeyHasMixedQuotesAsData2='Y"
4852
'''
4953

5054
@pytest.fixture(scope='module')
@@ -128,3 +132,7 @@ def test_env_with_quote(config):
128132
assert '"text' == config('KeyWithDoubleQuoteBegin')
129133
assert '"' == config('KeyIsDoubleQuote')
130134
assert "'" == config('KeyIsSingleQuote')
135+
assert "'Y'" == config('KeyHasTwoSingleQuote')
136+
assert '"Y"' == config('KeyHasTwoDoubleQuote')
137+
assert '''"Y\'''' == config('KeyHasMixedQuotesAsData1')
138+
assert '''\'Y"''' == config('KeyHasMixedQuotesAsData2')

0 commit comments

Comments
 (0)