Permalink
Browse files

Fix unit tests failing on Python 3.7 (#62)

  • Loading branch information...
Delgan committed Jan 7, 2019
1 parent 0b13582 commit 4d6a9daf6a90ce7b01d9607d3031b30b2bd1593b
Showing with 20 additions and 3 deletions.
  1. +18 −3 better_exceptions/__main__.py
  2. +2 −0 test_all.sh
@@ -1,7 +1,23 @@
import argparse
import imp
import os

try:
import importlib.machinery
import importlib.util

def load_module(name, filepath):
loader = importlib.machinery.SourceFileLoader(name, filepath)
spec = importlib.util.spec_from_loader(loader.name, loader)
mod = importlib.util.module_from_spec(spec)
loader.exec_module(mod)

except ImportError:
import imp

def load_module(name, filepath):
with open(filepath, 'r') as fd:
imp.load_module('a_b', f, path, ('.py', 'U', imp.PY_SOURCE))

from better_exceptions import interact, hook
hook()

@@ -12,7 +28,6 @@

startup_file = os.getenv('PYTHONSTARTUP')
if not args.no_init and startup_file is not None:
with open(startup_file, 'r') as fd:
imp.load_module('pystartup', fd, startup_file, ('.py', 'r', imp.PY_SOURCE))
load_module('pystartup', startup_file)

interact(args.quiet)
@@ -54,6 +54,8 @@ for encoding in ascii "UTF-8"; do

export LANG="en_US.${encoding}"
export LC_ALL="${LANG}"
export PYTHONCOERCECLOCALE=0
export PYTHONUTF8=0
export TERM="${term}"
export FORCE_COLOR="${color}"
export BETEXC_PYTHON="python${pv}"

0 comments on commit 4d6a9da

Please sign in to comment.