Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Make ENIP tests tolerate missing root log handlers#121

Open
lazydreamy wants to merge 1 commit into
pjkundert:master from
lazydreamy:pr/fix-enip-test-logging
Open

Make ENIP tests tolerate missing root log handlers #121
lazydreamy wants to merge 1 commit into
pjkundert:master from
lazydreamy:pr/fix-enip-test-logging

Conversation

@lazydreamy

@lazydreamy lazydreamy commented Jun 10, 2026

Copy link
Copy Markdown

Summary

Allow ENIP parser and UDT tests to be collected when pytest has not installed a root logging handler yet.

Some Python 2 / pytest environments leave the root logger without handlers during test module import. The existing tests immediately access handlers[0], which raises IndexError during collection before the tests can run.

Changes

  • Configure default logging with logging.basicConfig(**log_cfg) only when the root logger has no handlers.
  • Preserve the existing formatter behavior when a handler is already present.

Testing

  • py -2.7 -m pytest server/enip/parser_test.py server/enip/udt_test.py

Configure default logging in parser and UDT tests when pytest has not installed a root handler yet. This keeps the existing tests collectable on Python 2 with pytest 4.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /