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(-)
diff --git a/tests/py/nft-test.py b/tests/py/nft-test.py
index f80517e67bfd..4da6fa650f6d 100755
--- a/tests/py/nft-test.py
+++ b/tests/py/nft-test.py
@@ -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": {
--
2.20.1