File: 0003-Use-tempfile-module-to-create-output-file-in-tests.patch

package info (click to toggle)
python-crontab 3.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 544 kB
  • sloc: python: 2,921; sh: 6; makefile: 3
file content (30 lines) | stat: -rw-r--r-- 686 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From: Michael Fladischer <FladischerMichael@fladi.at>
Date: Wed, 25 Nov 2020 23:11:08 +0100
Subject: Use tempfile module to create output file in tests.

---
 crontab.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/crontab.py b/crontab.py
index ae258b9..adea392 100644
--- a/crontab.py
+++ b/crontab.py
@@ -18,6 +18,7 @@
 """
 from crontab import CronTab
 import sys
+import tempfile
 
 # Create a new non-installed crontab
 cron = CronTab(tab='')
@@ -68,7 +69,8 @@ output = cron.render()
 
 cron.write()
 
-cron.write(filename='/tmp/output.txt')
+with tempfile.NamedTemporaryFile() as fp:
+    cron.write(filename=fp.name)
 
 #cron.write_to_user(user=True)