Skip to content

Commit

Permalink
fixed placement of test env
Browse files Browse the repository at this point in the history
  • Loading branch information
josephmancuso committed Jun 8, 2019
1 parent d1d956b commit c1819ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions masonite/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ def __init__(self, env=None, override=True, only=None):
from dotenv import load_dotenv
self.env = load_dotenv

if "pytest" in sys.modules:
self._load_environment('testing', override=override)

if only:
self._load_environment(only, override=override)
return
Expand All @@ -34,6 +31,9 @@ def __init__(self, env=None, override=True, only=None):
'APP_ENV'), override=override)
if env:
self._load_environment(env, override=override)

if "pytest" in sys.modules:
self._load_environment('testing', override=override)

def _load_environment(self, env, override=False):
"""Load the environment depending on the env file.
Expand Down
2 changes: 1 addition & 1 deletion tests/testing/test_route_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ def test_patch(self):

def test_csrf(self):
self.with_csrf()
with self.assertRaises(InvalidCSRFToken) as context:
with self.assertRaises(InvalidCSRFToken):
self.assertTrue(self.post('/unit/test/json', {'test': 'testing'}).contains('testing'))

0 comments on commit c1819ef

Please sign in to comment.