Add pytest-xdist to the travis build.

This commit is contained in:
Michael Lazar
2016-08-11 01:18:41 -07:00
parent bd7c63cd5f
commit 720a62faf6
2 changed files with 8 additions and 7 deletions

View File

@@ -5,11 +5,11 @@ python:
- "3.4" - "3.4"
- "3.5" - "3.5"
before_install: before_install:
- pip install coveralls pytest coverage mock pylint vcrpy - pip install coveralls pytest pytest-xdist coverage mock pylint vcrpy
install: install:
- pip install . - pip install .
script: script:
- pylint --rcfile .pylintrc -E rtv/ - pylint --rcfile .pylintrc -E rtv/
- coverage run -m py.test -v - coverage run -m py.test -v -n auto
after_success: after_success:
- coveralls - coveralls

View File

@@ -7,13 +7,12 @@ import time
import codecs import codecs
import curses import curses
import logging import logging
import tempfile
import webbrowser import webbrowser
import subprocess import subprocess
import curses.ascii import curses.ascii
from curses import textpad from curses import textpad
from datetime import datetime
from contextlib import contextmanager from contextlib import contextmanager
from tempfile import NamedTemporaryFile
import six import six
from kitchen.text.display import textual_width_chop from kitchen.text.display import textual_width_chop
@@ -540,8 +539,10 @@ class Terminal(object):
text (str): The text that the user entered into the editor. text (str): The text that the user entered into the editor.
""" """
filename = 'rtv_{:%Y%m%d_%H%M%S}.txt'.format(datetime.now()) with NamedTemporaryFile(prefix='rtv_', suffix='.txt', delete=False) as fp:
filepath = os.path.join(tempfile.gettempdir(), filename) # Create a tempory file and grab the name, but close immediately so
# we can re-open using the right encoding
filepath = fp.name
with codecs.open(filepath, 'w', 'utf-8') as fp: with codecs.open(filepath, 'w', 'utf-8') as fp:
fp.write(data) fp.write(data)
@@ -568,7 +569,7 @@ class Terminal(object):
# All exceptions will cause the file to *not* be removed, but these # All exceptions will cause the file to *not* be removed, but these
# ones should also be swallowed # ones should also be swallowed
_logger.info('Caught TemporaryFileError') _logger.info('Caught TemporaryFileError')
self.show_notification('Post saved as: %s', filepath) self.show_notification('Post saved as: %s' % filepath)
else: else:
# If no errors occurred, try to remove the file # If no errors occurred, try to remove the file
try: try: