tests: py: use tempfile module
PATCH 1/1 tests: py: use tempfile module
os.tmpfile() is not in python3.
Signed-off-by Eric Garver <[email protected]>
--- tests/py/nft-test.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tests/py/nft-test.py +3 -2
@@ -20,6 +20,7 @@ import argparse import signal import json import traceback +import tempfile TESTS_PATH = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, os.path.join(TESTS_PATH, '../../py/'))
@@ -771,7 +772,7 @@ def rule_add(rule, filename, lineno, force_all_family_option, filename_path): unit_tests += 1 table_flush(table, filename, lineno) - payload_log = os.tmpfile() + payload_log = tempfile.TemporaryFile(mode="w+") # Add rule and check return code cmd = "add rule %s %s %s" % (table, chain, rule[0])
@@ -911,7 +912,7 @@ def rule_add(rule, filename, lineno, force_all_family_option, filename_path): gotf.name, 1) table_flush(table, filename, lineno) - payload_log = os.tmpfile() + payload_log = tempfile.TemporaryFile(mode="w+") # Add rule in JSON format cmd = json.dumps({ "nftables": [{ "add": { "rule": {
Signature · 1 line
2.20.1
Quoted 4 lines · Eric Garver
os.tmpfile()is not in python3.Signed-off-by Eric Garver <[email protected]>---
Pablo,
Shekhar included this change in patch "[PATCH nft v9]tests: py: fix pyhton3". So this patch can be dropped.
Thanks.
Eric.