python3Packages.rclone-python: run tests
This commit is contained in:
parent
44c0690eb7
commit
e6dce4ad3e
@ -2,10 +2,12 @@
|
|||||||
lib,
|
lib,
|
||||||
buildPythonPackage,
|
buildPythonPackage,
|
||||||
fetchFromGitHub,
|
fetchFromGitHub,
|
||||||
|
pytestCheckHook,
|
||||||
replaceVars,
|
replaceVars,
|
||||||
setuptools,
|
setuptools,
|
||||||
rich,
|
rich,
|
||||||
rclone,
|
rclone,
|
||||||
|
writableTmpDirAsHomeHook,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
buildPythonPackage rec {
|
buildPythonPackage rec {
|
||||||
@ -32,8 +34,28 @@ buildPythonPackage rec {
|
|||||||
rich
|
rich
|
||||||
];
|
];
|
||||||
|
|
||||||
# tests require working internet connection
|
nativeCheckInputs = [
|
||||||
doCheck = false;
|
pytestCheckHook
|
||||||
|
writableTmpDirAsHomeHook
|
||||||
|
];
|
||||||
|
|
||||||
|
preCheck = ''
|
||||||
|
# Unlike upstream we don't actually run an S3 server for testing.
|
||||||
|
# See https://github.com/Johannes11833/rclone_python/blob/master/launch_test_server.sh
|
||||||
|
mkdir -p "$HOME/.config/rclone"
|
||||||
|
cat > "$HOME/.config/rclone/rclone.conf" <<EOF
|
||||||
|
[test_server_s3]
|
||||||
|
type = combine
|
||||||
|
upstreams = "testdir=$(mktemp -d)"
|
||||||
|
EOF
|
||||||
|
'';
|
||||||
|
|
||||||
|
disabledTestPaths = [
|
||||||
|
# test requires a remote that supports public links
|
||||||
|
"tests/test_link.py"
|
||||||
|
# test looks up latest version on rclone.org
|
||||||
|
"tests/test_version.py"
|
||||||
|
];
|
||||||
|
|
||||||
pythonImportsCheck = [ "rclone_python" ];
|
pythonImportsCheck = [ "rclone_python" ];
|
||||||
|
|
||||||
|
@ -97,3 +97,33 @@ index d4a8413..1b29bd8 100644
|
|||||||
|
|
||||||
# add optional arguments and flags to the command
|
# add optional arguments and flags to the command
|
||||||
args_str = args2string(args)
|
args_str = args2string(args)
|
||||||
|
diff --git a/tests/test_copy.py b/tests/test_copy.py
|
||||||
|
index 4ded5fa..1cae53b 100644
|
||||||
|
--- a/tests/test_copy.py
|
||||||
|
+++ b/tests/test_copy.py
|
||||||
|
@@ -45,11 +45,11 @@ def create_local_file(
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"wrapper_command,rclone_command",
|
||||||
|
[
|
||||||
|
- (rclone.copy, "rclone copy"),
|
||||||
|
- (rclone.copyto, "rclone copyto"),
|
||||||
|
- (rclone.sync, "rclone sync"),
|
||||||
|
- (rclone.move, "rclone move"),
|
||||||
|
- (rclone.moveto, "rclone moveto"),
|
||||||
|
+ (rclone.copy, "@rclone@ copy"),
|
||||||
|
+ (rclone.copyto, "@rclone@ copyto"),
|
||||||
|
+ (rclone.sync, "@rclone@ sync"),
|
||||||
|
+ (rclone.move, "@rclone@ move"),
|
||||||
|
+ (rclone.moveto, "@rclone@ moveto"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_rclone_command_called(wrapper_command: Callable, rclone_command: str):
|
||||||
|
@@ -62,7 +62,7 @@ def test_rclone_command_called(wrapper_command: Callable, rclone_command: str):
|
||||||
|
rclone.utils.subprocess,
|
||||||
|
"Popen",
|
||||||
|
return_value=subprocess.Popen(
|
||||||
|
- "rclone help", stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True
|
||||||
|
+ "@rclone@ help", stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True
|
||||||
|
),
|
||||||
|
) as mock:
|
||||||
|
wrapper_command("nothing/not_a.file", "fake_remote:unicorn/folder")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user