To Do list for improving unit test suite ######################################## To Do ===== * Test coverage for module mainline code: Move the mainline code to a module ‘main’ function, and write complete unit tests for that function. * dput.helper.dputhelper * dput.dcut * dput.dput Postponed ========= * Code branches that break when tested. How did these ever work? * dput.methods.http:134(upload): for k, v in auth_headers.items(): “the loop never started” * dput.methods.http:151(upload): elif res.status == 401 and not auth_headers: “the condition was never true” * dput.methods.http:156(upload) if res.status == 401: “the condition was never true” * Code that pointlessly branches the control flow. These should be re-written to use a control structure that exhausts all the conditions. * dput.dput:876(main): elif option in ('-V', '--check_version'): “the condition was never false” Done ==== * Test coverage for omitted classes and functions: * dput.methods.http.PromptingPasswordMgr * dput.methods.http.AuthHandlerHackAround * Test coverage for omitted branches: * dput.helper.dputhelper:124(FileWithProgress.read): if self.size >= 0: “the condition was never false” * dput.dcut:91(getoptions): if options['debug']: “the condition was never false” * dput.methods.ftp:124(upload): if debug: “the condition was never false” * dput.dcut:418(dcut): if not options['filetocreate']: “the condition was never false” * dput.dcut:448(dcut): if not filename.endswith(".commands"): “the condition was never false” * dput.dcut:461(dcut): if not options['filetocreate']: “the condition was never false” * dput.dput:257(verify_signature): if isinstance(exc, crypto.gpg.errors.GPGMEError): “the condition was never false” * dput.methods.scp:43(upload): if not stat.S_IMODE(os.lstat(file)[stat.ST_MODE]) == 0o644: “the condition was never false” * Remove code that is never used: * dput.helper.dputhelper.TimestampFile * Code that pointlessly branches the control flow. These should be re-written to use a control structure that exhausts all the conditions. * dput.dput:970(main): elif not config.has_section(args[0]): “the condition was never false” * Code that may be incorrectly reported as lacking coverage. Debug trace shows that this branch *is* adequately covered. Why is the coverage report saying this is not covered? * dput.dput:134(read_configs): if debug: “the condition was never false” * Code branches that pointlessly retry a config failure. When `config.get` fails to find the option in the requested section, it automatically falls back to the ‘DEFAULT’ section. So if this call fails, attempting to find the option in ‘DEFAULT’ will just fail anyway. * dput.dcut:317(upload_stolen_from_dput_main): if not config.get(host, 'method'): “the condition was never true” * dput.dput:1055(main): if not config.get(host, 'method'): “the condition was never true” * dput.dcut:429(dcut): if config.has_option(options['host'], 'allow_dcut'): “the condition was never false” * dput.dcut:327(upload_stolen_from_dput_main): elif ( config.has_option('DEFAULT', 'login') and config.get('DEFAULT', 'login') != 'username'): “line 327 didn't jump to line 330” * dput.dput:1068(main): elif ( len(config.get('DEFAULT', 'login')) != 0 and config.get('DEFAULT', 'login') != 'username'): “line 1068 didn't jump to line 1071” .. Local variables: coding: utf-8 mode: text mode: rst End: vim: fileencoding=utf-8 filetype=rst :