Issue2332

classification
Title: jython -m regrtest failing to find tests
Type: behaviour Severity: normal
Components: Library Versions: Jython 2.7
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jeff.allen Nosy List: jeff.allen, zyasoft
Priority: Keywords:

Created on 2015-04-19.08:05:02 by jeff.allen, last changed 2015-04-20.20:53:26 by zyasoft.

Messages
msg9882 (view) Author: Jeff Allen (jeff.allen) Date: 2015-04-19.08:05:01
Run with the Jython -m switch, I only see these tests go by:
>dist\bin\jython -m test.regrtest -e
test_grammar
test_opcodes
test_dict
test_builtin
test_exceptions
test_types
test_unittest
test_doctest
test_doctest2
All 9 tests OK.

Without the -e, this is followed by:
1 test skipped:
    test_py3kwarn

then a charmingly self-deprecating poème concrète that begins:
152 tests ran unexpectedly:
    # CPython Command Could GC Java, Jython Nonreliable Not Python

I'm pretty sure the poem is a consequence of including comments where they aren't recognised. As the comments are useful, I'll see if we can tolerate them, rather than just remove them.

Not sure about the connection with -m: path problem in finding the test directory, I suspect.
msg9884 (view) Author: Jeff Allen (jeff.allen) Date: 2015-04-19.09:39:36
If I put a bit of self-explanatory debug into findtestdir, I see:
findtestdir: __name__ = __main__
findtestdir: sys.argv[0] = test.regrtest
findtestdir: __file__ = <path to Jython>\dist\Lib\test\regrtest.py
findtestdir: os.curdir = .

The same debug in a Jython reverted to just after Christmas gives me:
findtestdir: __name__ = __main__
findtestdir: sys.argv[0] = <path to Jython>\dist\Lib\test\regrtest.py
findtestdir: __file__ = <path to Jython>\dist\Lib\test\regrtest.py
findtestdir: os.curdir = .

Finally, in a CPython installation:
findtestdir: __name__ = __main__
findtestdir: sys.argv[0] = <path to Python 2.7>\lib\test\regrtest.py
findtestdir: __file__ = <path to Python 2.7>\lib\test\regrtest.py
findtestdir: os.curdir = .

These are all run with -m test.regrtest .

I will fix regrtest by copying in the lib-python definition of findtestdir, which is shorter anyway and doesn't use sys.argv. However, something is wrong with sys.argv.
msg9894 (view) Author: Jim Baker (zyasoft) Date: 2015-04-19.22:01:37
It's probably worth posting the entire output:

$ jython27 -m test.regrtest
test_grammar
test_opcodes
test_dict
test_builtin
test_exceptions
test_types
test_unittest
test_doctest
test_doctest2
test_py3kwarn
test_py3kwarn skipped -- test.test_py3kwarn must be run with the -3 flag
9 tests OK.
1 test skipped:
    test_py3kwarn
148 tests ran unexpectedly:
    # CPython Command Could GC Java, Jython Nonreliable Not Python
    Requires Should Tests The additional are at but bytecode cause
    compilation currently do, emulation files fix following for hang
    hard hardcoded in is issues jumping least line not on or pyc
    requires revisit rewrite run should so socket-reboot, subsequently
    support supportable test__locale test__rawffi test_aepack test_al
    test_applesingle test_ascii_formatd test_asynchat test_asyncore
    test_audioop test_bsddb test_bsddb185 test_bsddb3 test_capi
    test_cd test_cl test_cmd_line_script test_compileall test_cprofile
    test_ctypes test_distutils test_dl test_email_codecs test_epoll
    test_fcntl test_fork1 test_ftplib test_gdb test_gdbm test_getargs2
    test_gl test_hotshot test_httplib test_imageop test_imgfile
    test_io test_ioctl test_kqueue test_largefile test_linuxaudiodev
    test_locale test_longexp test_macfs test_macos test_macostools
    test_mmap test_modulefinder test_msilib test_multiprocessing
    test_nis test_nt_paths_jy test_openpty test_ossaudiodev
    test_parser test_pep277 test_plistlib test_poll test_poplib
    test_profile test_pty test_pydoc test_resource test_rgbimg
    test_scriptpackages test_select_new test_smtplib test_socket_ssl
    test_sqlite test_startfile test_strop test_structmembers
    test_sunaudiodev test_sundry test_symtable test_sys_setprofile
    test_sys_settrace test_tcl test_telnetlib test_timeout test_tk
    test_tools test_ttk_guionly test_ttk_textonly test_unicode_file
    test_wait3 test_wait4 test_wave test_winreg test_winsound
    test_zipfile64 testing tests that these they to with work

So we have an amusing line being generated strictly from hash ordering of the commented out tests, and their comments, from the setting of _expectations in Lib/test/regrtest.py
msg9905 (view) Author: Jeff Allen (jeff.allen) Date: 2015-04-19.23:19:42
It's alphabetic. We were inserting comments, but the program just treats them like test names. But even the ones that are test names emerge because of (what seems to me) faulty logic around the -e flag. These tests are supposed to be skipped (supposed to skip themselves) but in this case we have no intention of running them. This gets them listed, because they're expected skips, but not recorded as skipped. regrtest erroneously concludes from this that they ran unexpectedly.

I claim this fixes it: https://hg.python.org/jython/rev/0689142744de

I've tested various combinations of -e and -m. Worth checking.
msg9911 (view) Author: Jim Baker (zyasoft) Date: 2015-04-20.20:53:26
Works for me very nicely, and it's a good thing to do after doing an install.
History
Date User Action Args
2015-04-20 20:53:26zyasoftsetstatus: pending -> closed
messages: + msg9911
2015-04-19 23:19:42jeff.allensetstatus: open -> pending
resolution: fixed
messages: + msg9905
2015-04-19 22:01:38zyasoftsetmessages: + msg9894
2015-04-19 09:39:37jeff.allensetnosy: + zyasoft
type: behaviour
messages: + msg9884
2015-04-19 08:05:02jeff.allencreate