trentm / trentm/python-markdown2

ResourceWarnings in test suite with Python >=3.2

Open
#98 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.8k
Forks
459
Avg merge
2d 19h
Merged PRs (30d)
4

Description

When warnings are enabled (e.g. using PYTHONWARNINGS="d" environmental variable or -Wd option), then some ResourceWarnings occur when running tests with Python >=3.2.

./test_markdown2.py:207: ResourceWarning: unclosed file <_io.TextIOWrapper name='./tm-cases/sublist-para.tags' mode='r' encoding='UTF-8'>
  for line in open(tags_path):
./test_markdown2.py:187: ResourceWarning: unclosed file <_io.TextIOWrapper name='./tm-cases/pyshell.opts' mode='r' encoding='UTF-8'>
  opts = eval(open(opts_path, 'r').read())
./test_markdown2.py:187: ResourceWarning: unclosed file <_io.TextIOWrapper name='./tm-cases/link_patterns_edge_cases.opts' mode='r' encoding='UTF-8'>
  opts = eval(open(opts_path, 'r').read())
./test_markdown2.py:207: ResourceWarning: unclosed file <_io.TextIOWrapper name='./tm-cases/link_patterns_edge_cases.tags' mode='r' encoding='UTF-8'>
  for line in open(tags_path):
./test_markdown2.py:187: ResourceWarning: unclosed file <_io.TextIOWrapper name='./tm-cases/html_classes.opts' mode='r' encoding='UTF-8'>
  opts = eval(open(opts_path, 'r').read())
./test_markdown2.py:207: ResourceWarning: unclosed file <_io.TextIOWrapper name='./tm-cases/html_classes.tags' mode='r' encoding='UTF-8'>
  for line in open(tags_path):
...

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in test_markdown2.py at lines 187 and 207, where the reported unclosed files are opened while running the test suite. Run the tests with PYTHONWARNINGS="d" or -Wd enabled and inspect those paths. Done means the test suite no longer emits the listed ResourceWarnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.