summaryrefslogtreecommitdiff
path: root/coverage
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2019-04-08 18:50:05 -0400
committerNed Batchelder <ned@nedbatchelder.com>2019-04-09 08:01:19 -0400
commit10018dd90852d78cd2d04c4fb5874028d6ec2c51 (patch)
tree8cfd69e091f592f255837ee1cfd1d1b3b8eb9b15 /coverage
parentcd15bc3e8dbed5b027497185b7bb7f30f2c49ea8 (diff)
downloadpython-coveragepy-git-10018dd90852d78cd2d04c4fb5874028d6ec2c51.tar.gz
A little clean-up from pr #760
Diffstat (limited to 'coverage')
-rw-r--r--coverage/backward.py6
-rw-r--r--coverage/sqldata.py11
2 files changed, 8 insertions, 9 deletions
diff --git a/coverage/backward.py b/coverage/backward.py
index b43e35f3..2d0494a7 100644
--- a/coverage/backward.py
+++ b/coverage/backward.py
@@ -44,6 +44,12 @@ try:
except NameError:
range = range
+# Where do we get the thread id from?
+try:
+ from thread import get_ident as get_thread_id
+except ImportError:
+ from threading import get_ident as get_thread_id
+
# shlex.quote is new, but there's an undocumented implementation in "pipes",
# who knew!?
try:
diff --git a/coverage/sqldata.py b/coverage/sqldata.py
index b44556a5..09d647e5 100644
--- a/coverage/sqldata.py
+++ b/coverage/sqldata.py
@@ -17,18 +17,12 @@ import os
import sqlite3
import sys
-from coverage import env
-from coverage.backward import iitems
+from coverage.backward import get_thread_id, iitems
from coverage.data import filename_suffix
from coverage.debug import NoDebugging, SimpleReprMixin
from coverage.files import PathAliases
from coverage.misc import CoverageException, file_be_gone
-if env.PY2:
- from thread import get_ident as get_thread_id
-else:
- from threading import get_ident as get_thread_id
-
# Schema versions:
# 1: Released in 5.0a2
@@ -168,8 +162,7 @@ class CoverageSqliteData(SimpleReprMixin):
return self._dbs[get_thread_id()]
def __nonzero__(self):
- if (get_thread_id() not in self._dbs and
- not os.path.exists(self.filename)):
+ if (get_thread_id() not in self._dbs and not os.path.exists(self.filename)):
return False
try:
with self._connect() as con: