Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextLintBearTest: Close opened test files properly #2048

Open
Makman2 opened this issue Sep 25, 2017 · 11 comments
Open

TextLintBearTest: Close opened test files properly #2048

Makman2 opened this issue Sep 25, 2017 · 11 comments

Comments

@Makman2
Copy link
Member

Makman2 commented Sep 25, 2017

py.test gives warnings on https://circleci.com/gh/coala/coala-bears/7126 like

tests/general/TextLintBearTest.py::TextLintBearTest::test_bad_no_start_duplicated_conjunction
  /home/ubuntu/coala-bears/tests/general/TextLintBearTest.py:19: ResourceWarning: unclosed file <_io.TextIOWrapper name='/home/ubuntu/coala-bears/tests/general/textlint_test_files/bad_no_start_duplicated_conjunction.txt' mode='r' encoding='UTF-8'>
    return open(get_testfile_path(name)).readlines()

To not rely on ref-counting for object destruction (which isn't anyway an official feature in Python to allow custom destructors), we should close the file manually by using a with-context:

with open(get_testfile_path(name)) as fl:
    return fl.readlines()
sitharaPN-space added a commit to sitharaPN-space/coala-bears that referenced this issue Sep 28, 2017
        In above file, load_testfile() needs to be changed, and changed
        it. Add another function called close_testfile() to close the file
Closes :  coala#2048
sitharaPN-space added a commit to sitharaPN-space/coala-bears that referenced this issue Sep 28, 2017
     fix the syntax error changed the close_file
Closes :  coala#2048
sitharaPN-space added a commit to sitharaPN-space/coala-bears that referenced this issue Sep 28, 2017
        In above file, load_testfile() needs to be changed, and changed
        it. Add another function called close_testfile() to close the file
	and try to avoid gitmate-bot complains

Fixes  coala#2048
@nealkarpe
Copy link
Member

@Makman2 I think this can be kept up for grabs again! 😀 (Unassigned due to inactivity)

@Makman2
Copy link
Member Author

Makman2 commented Nov 11, 2017

Unassigning due to inactivity.

@jayvdb
Copy link
Member

jayvdb commented Nov 12, 2017

Re-assign. Close the PR before unassigning.

@Makman2
Copy link
Member Author

Makman2 commented Nov 12, 2017

Haven't seen the PR^^ (thought just commits were done without a PR)
Thanks for attaching the reference there @jayvdb 👍

@vddesai1871
Copy link
Contributor

Hey, @akspr7 if you are not working on this issue anymore I would like to take this issue.

@Makman2
Copy link
Member Author

Makman2 commented Dec 10, 2017

Oh you already have a difficulty/newcomer issue assigned @vddesai1998 , please pick a difficulty/low one ;)

@vddesai1871
Copy link
Contributor

Okay :)

@Subhash-Saurabh
Copy link

Hey @Makman2 I am new to coala and I want to work on this issue.

@thepavankoushik
Copy link

can you guys assign this to me ?

@Makman2
Copy link
Member Author

Makman2 commented Dec 13, 2017

@Subhash-Saurabh please accept the invitation.

@pavankoushik22 as @Subhash-Saurabh was first, please pick another issue :)

@Subhash-Saurabh
Copy link

@Makman2 I have accepted the invitation . Can you now assign me this issue.

Subhash-Saurabh added a commit to Subhash-Saurabh/coala-bears that referenced this issue Dec 15, 2017
Implemented closing the file by using a with context.

Fixes coala#2048
Subhash-Saurabh added a commit to Subhash-Saurabh/coala-bears that referenced this issue Dec 16, 2017
Implemented closing the file by using a with context.

Fixes coala#2048
Subhash-Saurabh added a commit to Subhash-Saurabh/coala-bears that referenced this issue Dec 17, 2017
Implemented closing the file by using a with context.

Closes coala#2048
Subhash-Saurabh added a commit to Subhash-Saurabh/coala-bears that referenced this issue Dec 18, 2017
Implemented closing the file by using a with context.

Closes coala#2048
gitmate-bot pushed a commit to Subhash-Saurabh/coala-bears that referenced this issue Dec 18, 2017
Implemented closing the file by using a with context.

Closes coala#2048
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment