summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwim glenn <hey@wimglenn.com>2018-08-30 19:06:20 -0500
committerwim glenn <hey@wimglenn.com>2018-08-30 19:06:20 -0500
commitc18a5b5179f724e7046742bae60da51dc74469d4 (patch)
tree1f62a428780dc95be56dbce79727fc82ee55d782
parented4b94a180412a292c9fe7e65faabbeb01f5f49c (diff)
downloadpytest-c18a5b5179f724e7046742bae60da51dc74469d4.tar.gz
try to be backwards compat
-rw-r--r--setup.py2
-rw-r--r--src/_pytest/terminal.py17
2 files changed, 13 insertions, 6 deletions
diff --git a/setup.py b/setup.py
index a3125611f..6207ad09b 100644
--- a/setup.py
+++ b/setup.py
@@ -59,7 +59,7 @@ def get_environment_marker_support_level():
def main():
extras_require = {}
install_requires = [
- "py>=1.6.0",
+ "py>=1.5.0",
"six>=1.10.0",
"setuptools",
"attrs>=17.4.0",
diff --git a/src/_pytest/terminal.py b/src/_pytest/terminal.py
index 48c652bd0..9fbae49c4 100644
--- a/src/_pytest/terminal.py
+++ b/src/_pytest/terminal.py
@@ -412,10 +412,12 @@ class TerminalReporter(object):
if last_item:
self._write_progress_information_filling_space()
else:
- past_edge = (
- self._tw.width_of_current_line + self._PROGRESS_LENGTH + 1
- >= self._screen_width
- )
+ try:
+ w = self._tw.width_of_current_line
+ except AttributeError:
+ # py < 1.6.0
+ w = self._tw.chars_on_current_line
+ past_edge = w + self._PROGRESS_LENGTH + 1 >= self._screen_width
if past_edge:
msg = self._get_progress_information_message()
self._tw.write(msg + "\n", cyan=True)
@@ -433,7 +435,12 @@ class TerminalReporter(object):
def _write_progress_information_filling_space(self):
msg = self._get_progress_information_message()
- fill = self._tw.fullwidth - self._tw.width_of_current_line - 1
+ try:
+ w = self._tw.width_of_current_line
+ except AttributeError:
+ # py < 1.6.0
+ w = self._tw.chars_on_current_line
+ fill = self._tw.fullwidth - w - 1
self.write(msg.rjust(fill), cyan=True)
def pytest_collection(self):