This commit is contained in:
Florian Bruhin 2016-09-10 17:32:04 +02:00
parent bd5f63db46
commit 4c55963dc3
5 changed files with 10 additions and 11 deletions

View File

@ -31,7 +31,7 @@ import collections
import sip
from PyQt5.QtCore import (pyqtSlot, pyqtSignal, QObject, QTimer,
Qt, QVariant, QAbstractListModel, QModelIndex, QUrl)
Qt, QAbstractListModel, QModelIndex, QUrl)
from PyQt5.QtGui import QDesktopServices
from PyQt5.QtNetwork import QNetworkRequest, QNetworkReply
@ -384,7 +384,8 @@ class DownloadItem(QObject):
q.text = msg
q.mode = usertypes.PromptMode.yesno
q.answered_yes.connect(self._create_fileobj)
q.answered_no.connect(functools.partial(self.cancel, remove_data=False))
q.answered_no.connect(functools.partial(self.cancel,
remove_data=False))
q.cancelled.connect(functools.partial(self.cancel, remove_data=False))
self.cancelled.connect(q.abort)
self.error.connect(q.abort)

View File

@ -42,7 +42,7 @@ def temporary_download_dir(quteproc, tmpdir):
quteproc.set_setting('storage', 'download-directory', str(tmpdir))
(tmpdir / 'subdir').ensure(dir=True)
try:
os.mkfifo(str(tmpdir / 'fifo'))
os.mkfifo(str(tmpdir / 'fifo'))
except AttributeError:
pass
unwritable = tmpdir / 'unwritable'
@ -108,13 +108,15 @@ def download_prompt(tmpdir, quteproc, path):
@bdd.when("I open the download")
def download_open(quteproc):
cmd = '{} -c "import sys; print(sys.argv[1])"'.format(shlex.quote(sys.executable))
cmd = '{} -c "import sys; print(sys.argv[1])"'.format(
shlex.quote(sys.executable))
quteproc.send_cmd(':download-open {}'.format(cmd))
@bdd.when("I open the download with a placeholder")
def download_open(quteproc):
cmd = '{} -c "import sys; print(sys.argv[1])"'.format(shlex.quote(sys.executable))
def download_open_placeholder(quteproc):
cmd = '{} -c "import sys; print(sys.argv[1])"'.format(
shlex.quote(sys.executable))
quteproc.send_cmd(':download-open {} {{}}'.format(cmd))

View File

@ -87,7 +87,6 @@ def redirect_later_continue():
@app.route('/custom/content-size')
def content_size():
"""Send two bytes of data without a content-size."""
def generate_bytes():
yield b'*'
time.sleep(0.2)
@ -103,7 +102,6 @@ def content_size():
@app.route('/custom/twenty-mb')
def twenty_mb():
"""Send 20MB of data."""
def generate_bytes():
yield b'*' * 20 * 1024 * 1024

View File

@ -119,7 +119,7 @@ def test_ascii_locale(request, httpbin, tmpdir, quteproc_new):
@pytest.mark.linux
def test_misconfigured_user_dirs(request, httpbin, temp_basedir_env,
tmpdir, quteproc_new):
"""Test downloads with a misconfigured XDG_DOWNLOAD_DIR
"""Test downloads with a misconfigured XDG_DOWNLOAD_DIR.
https://github.com/The-Compiler/qutebrowser/issues/866
https://github.com/The-Compiler/qutebrowser/issues/1269

View File

@ -18,8 +18,6 @@
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
from PyQt5.QtCore import QUrl
from qutebrowser.browser.webkit import downloads