git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] git-p4 tests: cd to testdir before running python

From
Luke Diamand <luke@diamand.org>
Date
Apr 23, 2016, 14:13 UTC
Message-ID
<1461420826-4416-2-git-send-email-luke@diamand.org>
In-Reply-To
<1461420826-4416-1-git-send-email-luke@diamand.org>

The python one-liner for getting the current time prints out error messages if the current directory is deleted while it is running if using python3.

Avoid these messages by switching back to the test directory before running python3, instead of remaining in the trash directory.

Signed-off-by: Luke Diamand <luke@diamand.org>
---
 t/lib-git-p4.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh
index f9ae1d7..77802fe 100644
--- a/t/lib-git-p4.sh
+++ b/t/lib-git-p4.sh
@@ -50,7 +50,7 @@ native_path() {
 # at runtime (e.g. via NTP). The 'clock_gettime(CLOCK_MONOTONIC)'
 # function could fix that but it is not in Python until 3.3.
 time_in_seconds() {
-	python -c 'import time; print int(time.time())'
+	(cd "$TEST_DIRECTORY" && python -c 'import time; print(int(time.time()))')
 }
 
 # Try to pick a unique port: guess a large number, then hope
-- 
2.8.1.218.gd2cea43.dirty
Previous: Luke DiamandNext: Luke Diamand
Message 2 of 5 in “git-p4: support python3 in the tests”
  1. 0/2 git-p4: support python3 in the testsLuke Diamand, Apr 23, 2016
  2. 1/2 git-p4 tests: cd to testdir before running pythonLuke Diamand, Apr 23, 2016
  3. 2/2 git-p4 tests: work with python3 as well as python2Luke Diamand, Apr 23, 2016
  4. Junio C HamanoApr 25, 2016
  5. Luke DiamandApr 26, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.