Pytest: Unused function `setall`

Created on 12 May 2019  路  5Comments  路  Source: pytest-dev/pytest

Hi,

I was analyzing the test sorting algorithm and it stumbled upon this function setall which does not seem to be called by anything in the code:

https://github.com/pytest-dev/pytest/blob/6a43c8cd9405c68e223f4c6270bd1e1ac4bc8c5f/src/_pytest/python.py#L914-L924

Could anyone confirm that is the case? If so, guess it could be removed? I could do this quick PR.

It seems it was superseded by setmulti2?

https://github.com/pytest-dev/pytest/blob/6a43c8cd9405c68e223f4c6270bd1e1ac4bc8c5f/src/_pytest/python.py#L904-L912

enhancement

Most helpful comment

Usage removed in 40b85d7ee.

All 5 comments

Usage removed in 40b85d7ee.

at first glace this looks like its not exposed, so i believe removal is fine

there's a bunch more if you want to search through (using dead):

$ dead --exclude '^(doc/|bench/)' --tests testing | grep -Ev '(pytester|unittest\.py|visit_|^pytest_)'
exec_ is never read, defined in src/_pytest/_code/code.py:133
relline is never read, defined in src/_pytest/_code/code.py:186
putaround is only referenced in tests, defined in src/_pytest/_code/source.py:80
isparseable is only referenced in tests, defined in src/_pytest/_code/source.py:121
repr_unicode is never read, defined in src/_pytest/_io/saferepr.py:32
repr_instance is never read, defined in src/_pytest/_io/saferepr.py:50
_format_explanation is never read, defined in src/_pytest/assertion/rewrite.py:24
load_module is only referenced in tests, defined in src/_pytest/assertion/rewrite.py:282
RN is never read, defined in src/_pytest/assertion/rewrite.py:367
N is never read, defined in src/_pytest/assertion/rewrite.py:368
_saferepr is never read, defined in src/_pytest/assertion/rewrite.py:471
_format_assertmsg is never read, defined in src/_pytest/assertion/rewrite.py:493
_should_repr_global_name is never read, defined in src/_pytest/assertion/rewrite.py:519
_format_boolop is never read, defined in src/_pytest/assertion/rewrite.py:529
_call_reprcompare is never read, defined in src/_pytest/assertion/rewrite.py:537
makedir is only referenced in tests, defined in src/_pytest/cacheprovider.py:71
capsys is only referenced in tests, defined in src/_pytest/capture.py:263
capsysbinary is never read, defined in src/_pytest/capture.py:276
capfd is only referenced in tests, defined in src/_pytest/capture.py:293
capfdbinary is never read, defined in src/_pytest/capture.py:310
disabled is never read, defined in src/_pytest/capture.py:398
writelines is never read, defined in src/_pytest/capture.py:441
readline is never read, defined in src/_pytest/capture.py:717
readlines is only referenced in tests, defined in src/_pytest/capture.py:718
MODULE_NOT_FOUND_ERROR is only referenced in tests, defined in src/_pytest/compat.py:44
get_plugin_manager is only referenced in tests, defined in src/_pytest/config/__init__.py:168
addhooks is never read, defined in src/_pytest/config/__init__.py:249
hasplugin is only referenced in tests, defined in src/_pytest/config/__init__.py:332
fromdictargs is only referenced in tests, defined in src/_pytest/config/__init__.py:727
getvalueorskip is only referenced in tests, defined in src/_pytest/config/__init__.py:1025
do_c is never read, defined in src/_pytest/debugging.py:182
do_cont is never read, defined in src/_pytest/debugging.py:182
do_q is never read, defined in src/_pytest/debugging.py:198
do_exit is never read, defined in src/_pytest/debugging.py:199
report_failure is never read, defined in src/_pytest/doctest.py:149
report_unexpected_exception is never read, defined in src/_pytest/doctest.py:156
doctest_namespace is never read, defined in src/_pytest/doctest.py:567
applymarker is only referenced in tests, defined in src/_pytest/fixtures.py:449
getfuncargvalue is only referenced in tests, defined in src/_pytest/fixtures.py:480
defaultfuncargprefixmarker is never read, defined in src/_pytest/fixtures.py:1061
pytestconfig is only referenced in tests, defined in src/_pytest/fixtures.py:1064
conftest_options is never read, defined in src/_pytest/helpconfig.py:189
record_property is never read, defined in src/_pytest/junitxml.py:299
record_xml_attribute is never read, defined in src/_pytest/junitxml.py:320
record_testsuite_property is never read, defined in src/_pytest/junitxml.py:357
get_records is only referenced in tests, defined in src/_pytest/logging.py:239
record_tuples is only referenced in tests, defined in src/_pytest/logging.py:267
messages is only referenced in tests, defined in src/_pytest/logging.py:278
set_level is only referenced in tests, defined in src/_pytest/logging.py:298
at_level is only referenced in tests, defined in src/_pytest/logging.py:315
set_log_path is never read, defined in src/_pytest/logging.py:463
markname is never read, defined in src/_pytest/mark/structures.py:211
NodeMarkers is never read, defined in src/_pytest/mark/structures.py:370
RE_IMPORT_ERROR_NAME is never read, defined in src/_pytest/monkeypatch.py:18
context is only referenced in tests, defined in src/_pytest/monkeypatch.py:112
listnames is never read, defined in src/_pytest/nodes.py:221
_get_xunit_setup_teardown is never read, defined in src/_pytest/python.py:674
setall is never read, defined in src/_pytest/python.py:914
recwarn is only referenced in tests, defined in src/_pytest/recwarn.py:20
longreprtext is only referenced in tests, defined in src/_pytest/reports.py:62
count_towards_summary is never read, defined in src/_pytest/reports.py:114, src/_pytest/terminal.py:207
SHOW_PYTEST_WARNINGS_ARG is only referenced in tests, defined in src/_pytest/warnings.py:12
_fillfuncargs is only referenced in tests, defined in src/pytest.py:14

@asottile @nicoddemus should we do something about the the other dead ones as well?

Was this page helpful?
0 / 5 - 0 ratings