From 0a131ae199132ef1f7e488246fa9e2023606e148 Mon Sep 17 00:00:00 2001 From: Plamen Dimitrov Date: Sat, 16 Jun 2018 01:12:12 +0700 Subject: [PATCH] Use the system independent null device provided by python --- test/test_cnfvar.py | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/test_cnfvar.py b/test/test_cnfvar.py index dc5e1a6..3a0f18a 100755 --- a/test/test_cnfvar.py +++ b/test/test_cnfvar.py @@ -341,39 +341,39 @@ demo_cnf_comments = b""" class CnfVarUnittest(unittest.TestCase): def test_print_cnf(self): - with open("/dev/null", "w") as devnull: + with open(os.devnull, "w") as devnull: cnfvar.print_cnf(demo_cnfvar, out=devnull) def test_parse_cnf_simple(self): cnf = cnfvar.read_cnf(demo_cnf_group) - with open("/dev/null", "w") as devnull: + with open(os.devnull, "w") as devnull: cnfvar.print_cnf_json(cnf, out=devnull) def test_parse_cnf_nested(self): cnf = cnfvar.read_cnf(demo_cnf_filter) - with open("/dev/null", "w") as devnull: + with open(os.devnull, "w") as devnull: cnfvar.print_cnf_json(cnf, out=devnull) def test_parse_cnf_comments(self): cnf = cnfvar.read_cnf(demo_cnf_comments) - with open("/dev/null", "w") as devnull: + with open(os.devnull, "w") as devnull: cnfvar.print_cnf_json(cnf, out=devnull) def test_print_cnf_garbage(self): try: - with open("/dev/null", "w") as devnull: + with open(os.devnull, "w") as devnull: cnfvar.print_cnf(demo_invalid_cnfvar, out=devnull) except cnfvar.InvalidCNF: print ("Caught the duplicate line, bravo!") def test_read_json(self): cnf = cnfvar.read_cnf_json(demo_jsoncnf) - with open("/dev/null", "w") as devnull: + with open(os.devnull, "w") as devnull: cnfvar.print_cnf(cnf, out=devnull) def test_read_json_nonascii(self): cnf = cnfvar.read_cnf_json(demo_latin1crap) - with open("/dev/null", "w") as devnull: + with open(os.devnull, "w") as devnull: cnfvar.print_cnf(cnf, out=devnull) -- 1.7.1