HLasse / TextDescriptives

A Python library for calculating a large variety of metrics from text
https://hlasse.github.io/TextDescriptives/
Apache License 2.0
313 stars 23 forks source link

Issue with tests #199

Closed RichardLitt closed 1 year ago

RichardLitt commented 1 year ago

I ran the tests this morning, and 1) Python crashed around 15 times, which I assume is due to OSX and not this package, and 2) I got some error notes. Any idea how to minimize these?

➜  TextDescriptives git:(main) python3 -m test
== CPython 3.7.9 (v3.7.9:13c94747c7, Aug 15 2020, 01:31:08) [Clang 6.0 (clang-600.0.57)]
== Darwin-22.3.0-x86_64-i386-64bit little-endian
== cwd: /private/var/folders/vp/bfx6rdf97lj71rj8720bb7qr0000gn/T/test_python_21616
== CPU count: 16
== encodings: locale=UTF-8, FS=utf-8
0:00:00 load avg: 2.32 Run tests sequentially
0:00:00 load avg: 2.32 [  1/416] test_grammar
0:00:00 load avg: 2.32 [  2/416] test_opcodes
0:00:00 load avg: 2.32 [  3/416] test_dict
0:00:00 load avg: 2.32 [  4/416] test_builtin
0:00:00 load avg: 2.32 [  5/416] test_exceptions
0:00:02 load avg: 2.32 [  6/416] test_types
0:00:02 load avg: 2.32 [  7/416] test_unittest
0:00:03 load avg: 2.32 [  8/416] test_doctest
0:00:04 load avg: 2.21 [  9/416] test_doctest2
0:00:04 load avg: 2.21 [ 10/416] test_support
0:00:07 load avg: 2.21 [ 11/416] test___all__
0:00:08 load avg: 2.21 [ 12/416] test___future__
0:00:09 load avg: 2.21 [ 13/416] test__locale
0:00:09 load avg: 2.21 [ 14/416] test__opcode
0:00:09 load avg: 2.21 [ 15/416] test__osx_support
0:00:10 load avg: 2.27 [ 16/416] test_abc
0:00:10 load avg: 2.27 [ 17/416] test_abstract_numbers
0:00:10 load avg: 2.27 [ 18/416] test_aifc
0:00:10 load avg: 2.27 [ 19/416] test_argparse
0:00:12 load avg: 2.27 [ 20/416] test_array
0:00:13 load avg: 2.27 [ 21/416] test_asdl_parser
test_asdl_parser skipped -- test irrelevant for an installed Python
0:00:13 load avg: 2.27 [ 22/416] test_ast -- test_asdl_parser skipped
0:00:14 load avg: 2.17 [ 23/416] test_asyncgen
0:00:16 load avg: 2.17 [ 24/416] test_asynchat
0:00:17 load avg: 2.17 [ 25/416] test_asyncio
0:01:14 load avg: 1.77 [ 26/416] test_asyncore -- test_asyncio passed in 56.6 sec
0:01:16 load avg: 1.71 [ 27/416] test_atexit
0:01:16 load avg: 1.71 [ 28/416] test_audioop
0:01:17 load avg: 1.71 [ 29/416] test_augassign
0:01:17 load avg: 1.71 [ 30/416] test_base64
0:01:17 load avg: 1.71 [ 31/416] test_baseexception
0:01:17 load avg: 1.71 [ 32/416] test_bdb
0:01:17 load avg: 1.71 [ 33/416] test_bigaddrspace
0:01:18 load avg: 1.71 [ 34/416] test_bigmem
0:01:18 load avg: 1.71 [ 35/416] test_binascii
0:01:18 load avg: 1.71 [ 36/416] test_binhex
0:01:18 load avg: 1.71 [ 37/416] test_binop
0:01:18 load avg: 1.71 [ 38/416] test_bisect
0:01:19 load avg: 1.71 [ 39/416] test_bool
0:01:19 load avg: 1.71 [ 40/416] test_buffer
0:01:24 load avg: 1.73 [ 41/416] test_bufio
0:01:25 load avg: 1.59 [ 42/416] test_bytes
0:01:27 load avg: 1.59 [ 43/416] test_bz2
0:01:29 load avg: 1.59 [ 44/416] test_c_locale_coercion
0:01:31 load avg: 1.62 [ 45/416] test_calendar
0:01:33 load avg: 1.62 [ 46/416] test_call
0:01:33 load avg: 1.62 [ 47/416] test_capi
0:01:41 load avg: 1.67 [ 48/416] test_cgi
0:01:41 load avg: 1.67 [ 49/416] test_cgitb
0:01:41 load avg: 1.67 [ 50/416] test_charmapcodec
0:01:41 load avg: 1.67 [ 51/416] test_class
0:01:42 load avg: 1.67 [ 52/416] test_clinic
test_clinic skipped -- '/Library/Frameworks/Python.framework/Versions/3.7/lib/Tools/clinic' path does not exist
0:01:42 load avg: 1.67 [ 53/416] test_cmath -- test_clinic skipped
0:01:42 load avg: 1.67 [ 54/416] test_cmd
0:01:42 load avg: 1.67 [ 55/416] test_cmd_line
0:01:46 load avg: 1.70 [ 56/416] test_cmd_line_script
0:01:48 load avg: 1.70 [ 57/416] test_code
0:01:49 load avg: 1.70 [ 58/416] test_code_module
0:01:49 load avg: 1.70 [ 59/416] test_codeccallbacks
0:01:49 load avg: 1.70 [ 60/416] test_codecencodings_cn
0:01:49 load avg: 1.70 [ 61/416] test_codecencodings_hk
0:01:50 load avg: 1.70 [ 62/416] test_codecencodings_iso2022
0:01:50 load avg: 1.70 [ 63/416] test_codecencodings_jp
0:01:51 load avg: 1.64 [ 64/416] test_codecencodings_kr
0:01:51 load avg: 1.64 [ 65/416] test_codecencodings_tw
0:01:51 load avg: 1.64 [ 66/416] test_codecmaps_cn
0:01:51 load avg: 1.64 [ 67/416] test_codecmaps_hk
0:01:52 load avg: 1.64 [ 68/416] test_codecmaps_jp
0:01:52 load avg: 1.64 [ 69/416] test_codecmaps_kr
0:01:52 load avg: 1.64 [ 70/416] test_codecmaps_tw
0:01:52 load avg: 1.64 [ 71/416] test_codecs
0:01:53 load avg: 1.64 [ 72/416] test_codeop
0:01:53 load avg: 1.64 [ 73/416] test_collections
0:01:54 load avg: 1.64 [ 74/416] test_colorsys
0:01:54 load avg: 1.64 [ 75/416] test_compare
0:01:54 load avg: 1.64 [ 76/416] test_compile
0:01:56 load avg: 1.75 [ 77/416] test_compileall
0:02:00 load avg: 1.75 [ 78/416] test_complex
0:02:00 load avg: 1.75 [ 79/416] test_concurrent_futures
0:04:15 load avg: 1.45 [ 80/416] test_configparser -- test_concurrent_futures passed in 2 min 14 sec
0:04:15 load avg: 1.45 [ 81/416] test_contains
0:04:15 load avg: 1.45 [ 82/416] test_context
0:04:17 load avg: 1.45 [ 83/416] test_contextlib
0:04:17 load avg: 1.66 [ 84/416] test_contextlib_async
Task was destroyed but it is pending!
task: <Task pending coro=<<async_generator_athrow without __name__>()>>
Task was destroyed but it is pending!
task: <Task pending coro=<<async_generator_athrow without __name__>()>>
Task was destroyed but it is pending!
task: <Task pending coro=<<async_generator_athrow without __name__>()>>
0:04:17 load avg: 1.66 [ 85/416] test_copy
0:04:18 load avg: 1.66 [ 86/416] test_copyreg
0:04:18 load avg: 1.66 [ 87/416] test_coroutines
0:04:19 load avg: 1.66 [ 88/416] test_cprofile
0:04:19 load avg: 1.66 [ 89/416] test_crashers
0:04:20 load avg: 1.66 [ 90/416] test_crypt
0:04:20 load avg: 1.66 [ 91/416] test_csv
0:04:20 load avg: 1.66 [ 92/416] test_ctypes
test test_ctypes failed -- Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ctypes/test/test_macholib.py", line 49, in test_find
    self.assertEqual(find_lib('pthread'),
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ctypes/test/test_macholib.py", line 43, in find_lib
    raise ValueError("%s not found" % (name,))
ValueError: pthread not found

0:04:21 load avg: 1.66 [ 93/416/1] test_curses -- test_ctypes failed
test_curses skipped -- Use of the 'curses' resource not enabled
0:04:21 load avg: 1.66 [ 94/416/1] test_dataclasses -- test_curses skipped (resource denied)
0:04:22 load avg: 1.66 [ 95/416/1] test_datetime
0:04:25 load avg: 1.68 [ 96/416/1] test_dbm
0:04:26 load avg: 1.68 [ 97/416/1] test_dbm_dumb
0:04:26 load avg: 1.68 [ 98/416/1] test_dbm_gnu
test_dbm_gnu skipped -- No module named '_gdbm'
0:04:26 load avg: 1.68 [ 99/416/1] test_dbm_ndbm -- test_dbm_gnu skipped
0:04:27 load avg: 1.68 [100/416/1] test_decimal
0:04:30 load avg: 1.79 [101/416/1] test_decorators
0:04:30 load avg: 1.79 [102/416/1] test_defaultdict
0:04:30 load avg: 1.79 [103/416/1] test_deque
0:04:33 load avg: 1.88 [104/416/1] test_descr
0:04:35 load avg: 1.88 [105/416/1] test_descrtut
0:04:35 load avg: 1.88 [106/416/1] test_devpoll
test_devpoll skipped -- test works only on Solaris OS family
0:04:35 load avg: 1.88 [107/416/1] test_dict_version -- test_devpoll skipped
0:04:36 load avg: 1.88 [108/416/1] test_dictcomps
0:04:36 load avg: 1.88 [109/416/1] test_dictviews
0:04:36 load avg: 1.88 [110/416/1] test_difflib
0:04:37 load avg: 1.88 [111/416/1] test_dis
0:04:37 load avg: 1.89 [112/416/1] test_distutils
0:04:46 load avg: 1.82 [113/416/1] test_docxmlrpc
0:04:48 load avg: 1.76 [114/416/1] test_dtrace
0:04:48 load avg: 1.76 [115/416/1] test_dummy_thread
0:04:49 load avg: 1.76 [116/416/1] test_dummy_threading
0:04:49 load avg: 1.76 [117/416/1] test_dynamic
0:04:49 load avg: 1.76 [118/416/1] test_dynamicclassattribute
0:04:50 load avg: 1.76 [119/416/1] test_eintr
0:04:56 load avg: 1.86 [120/416/1] test_email
0:05:02 load avg: 2.03 [121/416/1] test_embed
0:05:02 load avg: 2.03 [122/416/1] test_ensurepip
0:05:02 load avg: 2.03 [123/416/1] test_enum
0:05:03 load avg: 2.02 [124/416/1] test_enumerate
0:05:03 load avg: 2.02 [125/416/1] test_eof
0:05:04 load avg: 2.02 [126/416/1] test_epoll
test_epoll skipped -- test works only on Linux 2.6
0:05:04 load avg: 2.02 [127/416/1] test_errno -- test_epoll skipped
0:05:04 load avg: 2.02 [128/416/1] test_exception_hierarchy
0:05:05 load avg: 2.02 [129/416/1] test_exception_variations
0:05:05 load avg: 2.02 [130/416/1] test_extcall
0:05:05 load avg: 2.02 [131/416/1] test_faulthandler
0:05:32 load avg: 1.67 [132/416/1] test_fcntl
0:05:33 load avg: 1.70 [133/416/1] test_file
0:05:33 load avg: 1.70 [134/416/1] test_file_eintr
0:05:35 load avg: 1.70 [135/416/1] test_filecmp
0:05:36 load avg: 1.70 [136/416/1] test_fileinput
0:05:36 load avg: 1.70 [137/416/1] test_fileio
0:05:37 load avg: 1.70 [138/416/1] test_finalization
0:05:39 load avg: 1.64 [139/416/1] test_float
0:05:39 load avg: 1.64 [140/416/1] test_flufl
0:05:39 load avg: 1.64 [141/416/1] test_fnmatch
0:05:40 load avg: 1.64 [142/416/1] test_fork1
0:05:46 load avg: 1.59 [143/416/1] test_format
0:05:47 load avg: 1.59 [144/416/1] test_fractions
0:05:47 load avg: 1.59 [145/416/1] test_frame
0:05:48 load avg: 1.59 [146/416/1] test_frozen
0:05:48 load avg: 2.42 [147/416/1] test_fstring
0:05:49 load avg: 2.42 [148/416/1] test_ftplib
0:05:50 load avg: 2.42 [149/416/1] test_funcattrs
0:05:50 load avg: 2.42 [150/416/1] test_functools
0:05:51 load avg: 2.42 [151/416/1] test_future
0:05:51 load avg: 2.42 [152/416/1] test_future3
0:05:52 load avg: 2.42 [153/416/1] test_future4
0:05:52 load avg: 2.42 [154/416/1] test_future5
0:05:52 load avg: 2.42 [155/416/1] test_gc
0:05:57 load avg: 2.47 [156/416/1] test_gdb
test_gdb skipped -- Couldn't find gdb on the path
0:05:57 load avg: 2.47 [157/416/1] test_generator_stop -- test_gdb skipped
0:05:58 load avg: 2.47 [158/416/1] test_generators
0:05:58 load avg: 2.51 [159/416/1] test_genericclass
0:05:59 load avg: 2.51 [160/416/1] test_genericpath
0:05:59 load avg: 2.51 [161/416/1] test_genexps
0:06:00 load avg: 2.51 [162/416/1] test_getargs2
0:06:00 load avg: 2.51 [163/416/1] test_getopt
0:06:00 load avg: 2.51 [164/416/1] test_getpass
0:06:01 load avg: 2.51 [165/416/1] test_gettext
0:06:01 load avg: 2.51 [166/416/1] test_glob
0:06:02 load avg: 2.51 [167/416/1] test_global
0:06:02 load avg: 2.51 [168/416/1] test_grp
0:06:03 load avg: 2.51 [169/416/1] test_gzip
0:06:04 load avg: 2.71 [170/416/1] test_hash
0:06:05 load avg: 2.71 [171/416/1] test_hashlib
0:06:06 load avg: 2.71 [172/416/1] test_heapq
0:06:06 load avg: 2.71 [173/416/1] test_hmac
0:06:07 load avg: 2.71 [174/416/1] test_html
0:06:07 load avg: 2.71 [175/416/1] test_htmlparser
0:06:08 load avg: 2.71 [176/416/1] test_http_cookiejar
0:06:08 load avg: 2.73 [177/416/1] test_http_cookies
0:06:09 load avg: 2.73 [178/416/1] test_httplib
0:06:09 load avg: 2.73 [179/416/1] test_httpservers
0:06:15 load avg: 2.60 [180/416/1] test_idle
0:06:16 load avg: 2.60 [181/416/1] test_imaplib
0:06:19 load avg: 2.55 [182/416/1] test_imghdr
0:06:19 load avg: 2.55 [183/416/1] test_imp
0:06:20 load avg: 2.55 [184/416/1] test_import
0:06:21 load avg: 2.55 [185/416/1] test_importlib
0:06:23 load avg: 2.55 [186/416/1] test_index
0:06:23 load avg: 2.55 [187/416/1] test_inspect
0:06:24 load avg: 2.74 [188/416/1] test_int
0:06:25 load avg: 2.74 [189/416/1] test_int_literal
0:06:25 load avg: 2.74 [190/416/1] test_io
0:07:06 load avg: 2.48 [191/416/1] test_ioctl -- test_io passed in 41.2 sec
0:07:07 load avg: 2.48 [192/416/1] test_ipaddress
0:07:07 load avg: 2.48 [193/416/1] test_isinstance
0:07:08 load avg: 2.48 [194/416/1] test_iter
0:07:08 load avg: 2.48 [195/416/1] test_iterlen
0:07:09 load avg: 2.48 [196/416/1] test_itertools
0:07:12 load avg: 2.44 [197/416/1] test_json
0:07:13 load avg: 2.44 [198/416/1] test_keyword
0:07:14 load avg: 2.32 [199/416/1] test_keywordonlyarg
0:07:14 load avg: 2.32 [200/416/1] test_kqueue
0:07:16 load avg: 2.32 [201/416/1] test_largefile
0:07:16 load avg: 2.32 [202/416/1] test_lib2to3
0:07:24 load avg: 2.19 [203/416/1] test_linecache
0:07:25 load avg: 2.19 [204/416/1] test_list
0:07:25 load avg: 2.19 [205/416/1] test_listcomps
0:07:26 load avg: 2.19 [206/416/1] test_locale
0:07:26 load avg: 2.19 [207/416/1] test_logging
Exception in thread Thread-444:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/test/test_logging.py", line 875, in serve_forever
    asyncore.loop(poll_interval, map=self._map)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncore.py", line 203, in loop
    poll_fun(timeout, map)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncore.py", line 144, in poll
    r, w, e = select.select(r, w, e, timeout)
OSError: [Errno 9] Bad file descriptor

0:07:48 load avg: 2.00 [208/416/1] test_long
0:07:50 load avg: 1.92 [209/416/1] test_longexp
0:07:51 load avg: 1.92 [210/416/1] test_lzma
0:07:57 load avg: 1.93 [211/416/1] test_macpath
0:07:57 load avg: 1.93 [212/416/1] test_mailbox
0:07:59 load avg: 1.93 [213/416/1] test_mailcap
0:07:59 load avg: 1.93 [214/416/1] test_marshal
0:08:00 load avg: 2.09 [215/416/1] test_math
0:08:01 load avg: 2.09 [216/416/1] test_memoryio
0:08:02 load avg: 2.09 [217/416/1] test_memoryview
0:08:04 load avg: 2.09 [218/416/1] test_metaclass
0:08:05 load avg: 2.09 [219/416/1] test_mimetypes
0:08:05 load avg: 2.09 [220/416/1] test_minidom
0:08:06 load avg: 2.09 [221/416/1] test_mmap
0:08:07 load avg: 2.09 [222/416/1] test_module
0:08:08 load avg: 2.09 [223/416/1] test_modulefinder
0:08:09 load avg: 2.09 [224/416/1] test_msilib
test_msilib skipped -- No module named 'msilib'
0:08:09 load avg: 2.09 [225/416/1] test_multibytecodec -- test_msilib skipped
0:08:10 load avg: 2.00 [226/416/1] test_multiprocessing_fork
test_multiprocessing_fork skipped -- test may crash on macOS (bpo-33725)
0:08:10 load avg: 2.00 [227/416/1] test_multiprocessing_forkserver -- test_multiprocessing_fork skipped
0:09:26 load avg: 2.03 [228/416/1] test_multiprocessing_main_handling -- test_multiprocessing_forkserver passed in 1 min 15 sec
0:09:37 load avg: 1.94 [229/416/1] test_multiprocessing_spawn
0:11:08 load avg: 2.22 [230/416/1] test_netrc -- test_multiprocessing_spawn passed in 1 min 30 sec
0:11:08 load avg: 2.22 [231/416/1] test_nis
0:11:09 load avg: 2.22 [232/416/1] test_nntplib
0:11:09 load avg: 2.22 [233/416/1] test_normalization
0:11:10 load avg: 2.22 [234/416/1] test_ntpath
0:11:10 load avg: 2.22 [235/416/1] test_numeric_tower
0:11:11 load avg: 2.22 [236/416/1] test_openpty
0:11:11 load avg: 2.22 [237/416/1] test_operator
0:11:12 load avg: 2.22 [238/416/1] test_optparse
0:11:12 load avg: 2.36 [239/416/1] test_ordered_dict
0:11:16 load avg: 2.36 [240/416/1] test_os
[1]    21616 killed     python3 -m test
HLasse commented 1 year ago

Hi @RichardLitt. It seems you're trying to use the test package for running the tests which looks like it's made for internal use by Python.

We use pytest for testing the package. There is a guide to running the tests in the FAQ in the documentation  here.

To sum up: Try installing the package using the following lines:

pip install -e ."[style,tests]"
pip install -r tests/requirements.txt

Then you can run the tests from the root directory using

pytest