python3-sh: fix tests
This commit is contained in:
parent
996851a13e
commit
769f5b0f43
2 changed files with 47 additions and 1 deletions
|
@ -0,0 +1,46 @@
|
|||
From 6b9fc9ace0219fd7199cb0d0261b01e364e96fe2 Mon Sep 17 00:00:00 2001
|
||||
From: Erik Cederstrand <erik@cederstrand.dk>
|
||||
Date: Mon, 16 Aug 2021 08:18:31 +0200
|
||||
Subject: [PATCH] CWD may be /tmp on some systems. Use a random dir instead.
|
||||
Fixes #582
|
||||
|
||||
---
|
||||
test.py | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/test.py b/test.py
|
||||
index 4e9e8e0..d438e30 100644
|
||||
--- a/test.py
|
||||
+++ b/test.py
|
||||
@@ -2261,13 +2261,15 @@ p.wait()
|
||||
|
||||
def test_pushd(self):
|
||||
""" test basic pushd functionality """
|
||||
+ child = realpath(tempfile.mkdtemp())
|
||||
+
|
||||
old_wd1 = sh.pwd().strip()
|
||||
old_wd2 = os.getcwd()
|
||||
|
||||
self.assertEqual(old_wd1, old_wd2)
|
||||
- self.assertNotEqual(old_wd1, tempdir)
|
||||
+ self.assertNotEqual(old_wd1, child)
|
||||
|
||||
- with sh.pushd(tempdir):
|
||||
+ with sh.pushd(child):
|
||||
new_wd1 = sh.pwd().strip()
|
||||
new_wd2 = os.getcwd()
|
||||
|
||||
@@ -2276,8 +2278,8 @@ p.wait()
|
||||
self.assertEqual(old_wd3, old_wd4)
|
||||
self.assertEqual(old_wd1, old_wd3)
|
||||
|
||||
- self.assertEqual(new_wd1, tempdir)
|
||||
- self.assertEqual(new_wd2, tempdir)
|
||||
+ self.assertEqual(new_wd1, child)
|
||||
+ self.assertEqual(new_wd2, child)
|
||||
|
||||
def test_pushd_cd(self):
|
||||
""" test that pushd works like pushd/popd with built-in cd correctly """
|
||||
--
|
||||
2.32.0
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
# Template file for 'python3-sh'
|
||||
pkgname=python3-sh
|
||||
version=1.14.2
|
||||
revision=1
|
||||
revision=2
|
||||
wrksrc="${pkgname#*-}-${version}"
|
||||
build_style=python3-module
|
||||
hostmakedepends="python3-setuptools"
|
||||
|
|
Loading…
Reference in a new issue