trash-cli: 0.12.9.14 -> 0.17.1.14

This commit is contained in:
ndowens 2017-03-02 19:44:17 -06:00 committed by Robert Helgesson
parent 3d2e118a55
commit 477014fd6a
No known key found for this signature in database
GPG key ID: C3DB11069E65DC86
3 changed files with 12 additions and 89 deletions

View file

@ -1,33 +1,29 @@
{ stdenv, fetchurl, substituteAll, coreutils, python2, python2Packages }:
{ stdenv, fetchFromGitHub, coreutils
, python3, python3Packages, substituteAll }:
assert stdenv.isLinux;
python2Packages.buildPythonApplication rec {
python3Packages.buildPythonApplication rec {
name = "trash-cli-${version}";
version = "0.12.9.14";
version = "0.17.1.14";
namePrefix = "";
src = fetchurl {
url = "https://github.com/andreafrancia/trash-cli/archive/${version}.tar.gz";
sha256 = "10idvzrlppj632pw6mpk1zy9arn1x4lly4d8nfy9cz4zqv06lhvh";
src = fetchFromGitHub {
owner = "andreafrancia";
repo = "trash-cli";
rev = "${version}";
sha256 = "1bqazna223ibqjwbc1wfvfnspfyrvjy8347qlrgv4cpng72n7gfi";
};
patches = [
# Fix paths.
(substituteAll {
src = ./nix-paths.patch;
df = "${coreutils}/bin/df";
python = "${python2}/bin/${python2.executable}";
libc = "${stdenv.cc.libc.out}/lib/libc.so.6";
})
# Apply https://github.com/JaviMerino/trash-cli/commit/4f45a37a3
# to fix failing test case.
./fix_should_output_info_for_multiple_files.patch
];
buildInputs = with python2Packages; [ nose mock ];
buildInputs = with python3Packages; [ nose mock ];
checkPhase = "nosetests";

View file

@ -1,60 +0,0 @@
From 4f45a37a390d7c844dd9c9b58fff7259a77ffff9 Mon Sep 17 00:00:00 2001
From: Javi Merino <merino.jav@gmail.com>
Date: Sun, 31 Aug 2014 05:45:17 -0700
Subject: [PATCH] Fix should_output_info_for_multiple_files
Test should_output_info_for_multiple_files fails because the output is
not in the same order as the input. Add assert_equal_any_order() to
the OutputCollector, which sorts the expected and actual lines so that
the output matches even if the order in which they are shown in
trash-list is different.
---
integration_tests/describe_trash_list.py | 8 +++++---
integration_tests/output_collector.py | 8 ++++++++
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/integration_tests/describe_trash_list.py b/integration_tests/describe_trash_list.py
index 6dd8d30..3489a22 100644
--- a/integration_tests/describe_trash_list.py
+++ b/integration_tests/describe_trash_list.py
@@ -73,9 +73,9 @@ def should_output_info_for_multiple_files(self):
self.user.run_trash_list()
- self.user.should_read_output( "2000-01-01 00:00:01 /file1\n"
- "2000-01-01 00:00:02 /file2\n"
- "2000-01-01 00:00:03 /file3\n")
+ self.user.should_read_output_any_order( "2000-01-01 00:00:01 /file1\n"
+ "2000-01-01 00:00:02 /file2\n"
+ "2000-01-01 00:00:03 /file3\n")
@istest
def should_output_unknown_dates_with_question_marks(self):
@@ -294,6 +294,8 @@ def error(self):
raise ValueError()
def should_read_output(self, expected_value):
self.stdout.assert_equal_to(expected_value)
+ def should_read_output_any_order(self, expected_value):
+ self.stdout.assert_equal_any_order(expected_value)
def should_read_error(self, expected_value):
self.stderr.assert_equal_to(expected_value)
def output(self):
diff --git a/integration_tests/output_collector.py b/integration_tests/output_collector.py
index 06dc002..7f3704f 100644
--- a/integration_tests/output_collector.py
+++ b/integration_tests/output_collector.py
@@ -9,6 +9,14 @@ def write(self,data):
self.stream.write(data)
def assert_equal_to(self, expected):
return self.should_be(expected)
+ def assert_equal_any_order(self, expected):
+ actual_sorted = sorted(self.stream.getvalue().splitlines(1))
+ actual = "".join(actual_sorted)
+
+ expected_sorted = sorted(expected.splitlines(1))
+ expected = "".join(expected_sorted)
+
+ assert_equals_with_unidiff(expected, actual)
def should_be(self, expected):
assert_equals_with_unidiff(expected, self.stream.getvalue())
def should_match(self, regex):

View file

@ -1,18 +1,5 @@
diff -Nurp trash-cli-0.12.9.14-orig/integration_tests/test_trash_rm_script.py trash-cli-0.12.9.14/integration_tests/test_trash_rm_script.py
--- trash-cli-0.12.9.14-orig/integration_tests/test_trash_rm_script.py 2014-12-23 10:10:43.808470486 +0100
+++ trash-cli-0.12.9.14/integration_tests/test_trash_rm_script.py 2014-12-23 10:11:02.688517975 +0100
@@ -9,7 +9,7 @@ from pprint import pprint
@istest
class WhenNoArgs:
def setUp(self):
- process = Popen(['python', 'trashcli/rm.py'],
+ process = Popen(['@python@', 'trashcli/rm.py'],
env={'PYTHONPATH':'.'},
stdin=None,
stdout=PIPE,
diff -Nurp trash-cli-0.12.9.14-orig/trashcli/list_mount_points.py trash-cli-0.12.9.14/trashcli/list_mount_points.py
--- trash-cli-0.12.9.14-orig/trashcli/list_mount_points.py 2014-12-23 10:10:43.808470486 +0100
+++ trash-cli-0.12.9.14/trashcli/list_mount_points.py 2014-12-23 10:19:04.954796457 +0100
--- a/trashcli/list_mount_points.py 2014-12-23 10:10:43.808470486 +0100
+++ a/trashcli/list_mount_points.py 2014-12-23 10:19:04.954796457 +0100
@@ -12,7 +12,7 @@ def mount_points_from_getmnt():
def mount_points_from_df():