-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rend le code des tutos plus pythonique
et j'en profite pour régler le problème de l'import json. Pour ce qui est des tests, j'ai commencé à travailler à les factoriser un peu pour qu'ils soient plus lisibles et donc plus maintenables et fiables. Pour l'instant j'ai factorisé que le tearDown mais j'ajouterai des choses après.
- Loading branch information
Showing
21 changed files
with
98 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
try: | ||
import ujson as json_handler | ||
except ImportError: | ||
try: | ||
import simplejson as json_handler | ||
except ImportError: | ||
import json as json_handler | ||
import logging | ||
logging.debug('json is loaded, module is %s', json_handler.__name__) # this allows to know which one we loaded | ||
# and avoid pep8 warning. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from django.conf import settings | ||
import os | ||
import shutil | ||
|
||
|
||
class TutorialTestMixin: | ||
def clean_media_dir(self): | ||
if os.path.isdir(self.overridden_zds_app['content']['repo_private_path']): | ||
shutil.rmtree(self.overridden_zds_app['content']['repo_private_path']) | ||
if os.path.isdir(self.overridden_zds_app['content']['repo_public_path']): | ||
shutil.rmtree(self.overridden_zds_app['content']['repo_public_path']) | ||
if os.path.isdir(self.overridden_zds_app['content']['extra_content_watchdog_dir']): | ||
shutil.rmtree(self.overridden_zds_app['content']['extra_content_watchdog_dir']) | ||
if os.path.isdir(settings.MEDIA_ROOT): | ||
shutil.rmtree(settings.MEDIA_ROOT) | ||
|
||
def tearDown(self): | ||
self.clean_media_dir() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.