Skip to content

Commit

Permalink
Fix #124
Browse files Browse the repository at this point in the history
  • Loading branch information
henriquebastos committed Sep 30, 2021
2 parents a3f3081 + 414acaa commit 51bb2e0
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 1 deletion.
60 changes: 60 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
##
# A GitHub Action to run Tox

name: Tox

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
pull_request:
branches:
- master
push:
branches:
- master
- tox-action

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
py37:
runs-on: ubuntu-latest
container: python:3.7-alpine

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

# Runs a single command using the runners shell
- name: Install Tox
run: pip install --user --upgrade tox

- name: Run Tox
env:
TOXENV: py37
run: |
"$HOME/.local/bin/tox"
py27:
runs-on: ubuntu-latest
container: python:2.7-alpine

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

# Runs a single command using the runners shell
- name: Install Tox
run: pip install --user --upgrade tox

- name: Run Tox
env:
TOXENV: py27
run: |
"$HOME/.local/bin/tox"
2 changes: 1 addition & 1 deletion decouple.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def __init__(self, source, encoding=DEFAULT_ENCODING):
k = k.strip()
v = v.strip()
if len(v) >= 2 and ((v[0] == "'" and v[-1] == "'") or (v[0] == '"' and v[-1] == '"')):
v = v.strip('\'"')
v = v[1:-1]
self.data[k] = v

def __contains__(self, key):
Expand Down
8 changes: 8 additions & 0 deletions tests/test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
KeyWithDoubleQuoteBegin="text
KeyIsSingleQuote='
KeyIsDoubleQuote="
KeyHasTwoSingleQuote="'Y'"
KeyHasTwoDoubleQuote='"Y"'
KeyHasMixedQuotesAsData1="Y'
KeyHasMixedQuotesAsData2='Y"
'''

@pytest.fixture(scope='module')
Expand Down Expand Up @@ -128,3 +132,7 @@ def test_env_with_quote(config):
assert '"text' == config('KeyWithDoubleQuoteBegin')
assert '"' == config('KeyIsDoubleQuote')
assert "'" == config('KeyIsSingleQuote')
assert "'Y'" == config('KeyHasTwoSingleQuote')
assert '"Y"' == config('KeyHasTwoDoubleQuote')
assert '''"Y\'''' == config('KeyHasMixedQuotesAsData1')
assert '''\'Y"''' == config('KeyHasMixedQuotesAsData2')

0 comments on commit 51bb2e0

Please sign in to comment.