Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1019 from edx/iamosbanjaved/python38_failures
Browse files Browse the repository at this point in the history
Fix python 3.8 failures
  • Loading branch information
iamsobanjaved authored Jun 9, 2020
2 parents f9fc6d4 + 9b01129 commit 7df9c07
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ matrix:
env:
TESTNAME=test-python-38
TARGETS="PYTHON_ENV=py38 requirements.js test_python"
allow_failures:
- python: 3.8



after_failure:
# Print the list of running containers to rule out a killed container as a cause of failure
Expand Down
13 changes: 10 additions & 3 deletions analytics_dashboard/courses/tests/test_views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import json
import logging

from unittest.mock import _is_started, Mock, patch
from unittest.mock import Mock, patch
import httpretty
from analyticsclient.exceptions import NotFoundError
from ddt import data, ddt
Expand Down Expand Up @@ -343,8 +343,15 @@ def start_patching(self):
_patch.start()

def stop_patching(self):
for _patch in self.patches:
if _is_started(_patch):
# TODO: Just for the compatibility with python 3.5.
# Can be removed once support is dropped
try:
from unittest.mock import _is_started # pylint: disable=import-outside-toplevel
for _patch in self.patches:
if _is_started(_patch):
_patch.stop()
except ImportError:
for _patch in self.patches:
_patch.stop()

def clear_patches(self):
Expand Down

0 comments on commit 7df9c07

Please sign in to comment.