| 1 |
To Do list for improving unit test suite |
| 2 |
######################################## |
| 3 |
|
| 4 |
To Do |
| 5 |
===== |
| 6 |
|
| 7 |
* Test coverage for module mainline code: |
| 8 |
|
| 9 |
Move the mainline code to a module ‘main’ function, and write |
| 10 |
complete unit tests for that function. |
| 11 |
|
| 12 |
* dput.helper.dputhelper |
| 13 |
* dput.dcut |
| 14 |
* dput.dput |
| 15 |
|
| 16 |
|
| 17 |
Postponed |
| 18 |
========= |
| 19 |
|
| 20 |
* Code branches that break when tested. How did these ever work? |
| 21 |
|
| 22 |
* dput.methods.http:134(upload): |
| 23 |
for k, v in auth_headers.items(): |
| 24 |
“the loop never started” |
| 25 |
|
| 26 |
* dput.methods.http:151(upload): |
| 27 |
elif res.status == 401 and not auth_headers: |
| 28 |
“the condition was never true” |
| 29 |
|
| 30 |
* dput.methods.http:156(upload) |
| 31 |
if res.status == 401: |
| 32 |
“the condition was never true” |
| 33 |
|
| 34 |
* Code that pointlessly branches the control flow. |
| 35 |
|
| 36 |
These should be re-written to use a control structure that exhausts |
| 37 |
all the conditions. |
| 38 |
|
| 39 |
* dput.dput:876(main): |
| 40 |
elif option in ('-V', '--check_version'): |
| 41 |
“the condition was never false” |
| 42 |
|
| 43 |
|
| 44 |
Done |
| 45 |
==== |
| 46 |
|
| 47 |
* Test coverage for omitted classes and functions: |
| 48 |
|
| 49 |
* dput.methods.http.PromptingPasswordMgr |
| 50 |
* dput.methods.http.AuthHandlerHackAround |
| 51 |
|
| 52 |
* Test coverage for omitted branches: |
| 53 |
|
| 54 |
* dput.helper.dputhelper:124(FileWithProgress.read): |
| 55 |
if self.size >= 0: |
| 56 |
“the condition was never false” |
| 57 |
|
| 58 |
* dput.dcut:91(getoptions): |
| 59 |
if options['debug']: |
| 60 |
“the condition was never false” |
| 61 |
|
| 62 |
* dput.methods.ftp:124(upload): |
| 63 |
if debug: |
| 64 |
“the condition was never false” |
| 65 |
|
| 66 |
* dput.dcut:418(dcut): |
| 67 |
if not options['filetocreate']: |
| 68 |
“the condition was never false” |
| 69 |
|
| 70 |
* dput.dcut:448(dcut): |
| 71 |
if not filename.endswith(".commands"): |
| 72 |
“the condition was never false” |
| 73 |
|
| 74 |
* dput.dcut:461(dcut): |
| 75 |
if not options['filetocreate']: |
| 76 |
“the condition was never false” |
| 77 |
|
| 78 |
* dput.dput:257(verify_signature): |
| 79 |
if isinstance(exc, crypto.gpg.errors.GPGMEError): |
| 80 |
“the condition was never false” |
| 81 |
|
| 82 |
* dput.methods.scp:43(upload): |
| 83 |
if not stat.S_IMODE(os.lstat(file)[stat.ST_MODE]) == 0o644: |
| 84 |
“the condition was never false” |
| 85 |
|
| 86 |
* Remove code that is never used: |
| 87 |
|
| 88 |
* dput.helper.dputhelper.TimestampFile |
| 89 |
|
| 90 |
* Code that pointlessly branches the control flow. |
| 91 |
|
| 92 |
These should be re-written to use a control structure that exhausts |
| 93 |
all the conditions. |
| 94 |
|
| 95 |
* dput.dput:970(main): |
| 96 |
elif not config.has_section(args[0]): |
| 97 |
“the condition was never false” |
| 98 |
|
| 99 |
* Code that may be incorrectly reported as lacking coverage. |
| 100 |
|
| 101 |
Debug trace shows that this branch *is* adequately covered. Why is |
| 102 |
the coverage report saying this is not covered? |
| 103 |
|
| 104 |
* dput.dput:134(read_configs): |
| 105 |
if debug: |
| 106 |
“the condition was never false” |
| 107 |
|
| 108 |
* Code branches that pointlessly retry a config failure. |
| 109 |
|
| 110 |
When `config.get` fails to find the option in the requested section, |
| 111 |
it automatically falls back to the ‘DEFAULT’ section. So if this |
| 112 |
call fails, attempting to find the option in ‘DEFAULT’ will just |
| 113 |
fail anyway. |
| 114 |
|
| 115 |
* dput.dcut:317(upload_stolen_from_dput_main): |
| 116 |
if not config.get(host, 'method'): |
| 117 |
“the condition was never true” |
| 118 |
|
| 119 |
* dput.dput:1055(main): |
| 120 |
if not config.get(host, 'method'): |
| 121 |
“the condition was never true” |
| 122 |
|
| 123 |
* dput.dcut:429(dcut): |
| 124 |
if config.has_option(options['host'], 'allow_dcut'): |
| 125 |
“the condition was never false” |
| 126 |
|
| 127 |
* dput.dcut:327(upload_stolen_from_dput_main): |
| 128 |
elif ( |
| 129 |
config.has_option('DEFAULT', 'login') |
| 130 |
and config.get('DEFAULT', 'login') != 'username'): |
| 131 |
“line 327 didn't jump to line 330” |
| 132 |
|
| 133 |
* dput.dput:1068(main): |
| 134 |
elif ( |
| 135 |
len(config.get('DEFAULT', 'login')) != 0 and |
| 136 |
config.get('DEFAULT', 'login') != 'username'): |
| 137 |
“line 1068 didn't jump to line 1071” |
| 138 |
|
| 139 |
|
| 140 |
.. |
| 141 |
Local variables: |
| 142 |
coding: utf-8 |
| 143 |
mode: text |
| 144 |
mode: rst |
| 145 |
End: |
| 146 |
vim: fileencoding=utf-8 filetype=rst : |