Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytest is not testing the command line arg parser correctly. #28

Open
jeffsilverm opened this issue Jan 11, 2019 · 0 comments
Open

pytest is not testing the command line arg parser correctly. #28

jeffsilverm opened this issue Jan 11, 2019 · 0 comments

Comments

@jeffsilverm
Copy link
Owner

When I start pytest_3 with the debugger using the pytest_3 -x --psd test/test_nbmdt.py command, pytest_3 drops into pdb at /home/jeffs/python/nbmdt/test/test_nbmdt.py(174)test_debug_option(). syserr_str is:
`

/home/jeffs/python/nbmdt/test/test_nbmdt.py(174)test_debug_option()
-> assert "nominal " in syserr_str.lower(), """ "nominal " not found in syserr_str""" + "\n" + syserr_str
(Pdb) syserr_str
'Testing the file special variable: /home/jeffs/python/nbmdt/utilities.py\nTesting the file special variable: /home/jeffs/python/nbmdt/application.py\n\x1b[32mDebugging network.py: /bin/ip, /bin/ping, /bin/ping6\x1b[0m\nTesting the file special variable: /home/jeffs/python/nbmdt/nbmdt.py\nThe debug option was set. Mode is Modes.DIAGNOSE coded as 3\nProblems unpacking a line not enough values to unpack (expected 5, got 0) from the ps command: \n\nskip it\nqlen_str is not a valid int. It's \nif_str is 4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default \ link/ether 02:42:02:fe:3e:9f brd ff:ff:ff:ff:ff:ff\n\nqlen_str is not a valid int. It's \nif_str is 19: vethc75b5727@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master cbr0 state UP mode DEFAULT group default \ link/ether 26:c6:9b:ff:ec:12 brd ff:ff:ff:ff:ff:ff link-netnsid 3\n\nqlen_str is not a valid int. It's \nif_str is 20: veth055373e3@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master cbr0 state UP mode DEFAULT group default \ link/ether 3e:cb:7d:f4:24:74 brd ff:ff:ff:ff:ff:ff link-netnsid 4\n\nqlen_str is not a valid int. It's \nif_str is 21: veth982b592e@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master cbr0 state UP mode DEFAULT group default \ link/ether 76:47:d5:7a:3c:98 brd ff:ff:ff:ff:ff:ff link-netnsid 2\n\nqlen_str is not a valid int. It's \nif_str is 22: vethdf72e796@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master cbr0 state UP mode DEFAULT group default \ link/ether de:61:f8:69:e5:5f brd ff:ff:ff:ff:ff:ff link-netnsid 5\n\nqlen_str is not a valid int. It's \nif_str is 23: veth13e9a885@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master cbr0 state UP mode DEFAULT group default \ link/ether fe:20:03:9f:e6:20 brd ff:ff:ff:ff:ff:ff link-netnsid 6\n\nqlen_str is not a valid int. It's \nif_str is 24: veth0cfe07e4@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master cbr0 state UP mode DEFAULT group default \ link/ether de:35:b0:08:3b:95 brd ff:ff:ff:ff:ff:ff link-netnsid 1\n\nqlen_str is not a valid int. It's \nif_str is 27: veth9b536b1f@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master cbr0 state UP mode DEFAULT group default \ link/ether 96:39:8a:e9:19:d7 brd ff:ff:ff:ff:ff:ff link-netnsid 0\n\nIn diagnostic mode, nomminal filename is mock_nbmdt_config.json\nTraceback (most recent call last):\n File "/home/jeffs/python/nbmdt/nbmdt.py", line 479, in \n main()\n File "/home/jeffs/python/nbmdt/nbmdt.py", line 313, in main\n current_system.diagnose(options.configuration_filename)\n File "/home/jeffs/python/nbmdt/nbmdt.py", line 272, in diagnose\n nominal_system: SystemDescription = SystemDescription.system_description_from_file(filename)\n File "/home/jeffs/python/nbmdt/nbmdt.py", line 119, in system_description_from_file\n so = json.load(f)\n File "/usr/lib/python3.6/json/init.py", line 299, in load\n parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)\n File "/usr/lib/python3.6/json/init.py", line 354, in loads\n return _default_decoder.decode(s)\n File "/usr/lib/python3.6/json/decoder.py", line 339, in decode\n obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode\n raise JSONDecodeError("Expecting value", s, err.value) from None\njson.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)\n'
(Pdb)

`
It looks to me as if syserr_str is getting appended to rather than overwritten.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant