[SOLVED] Missing inspection warning for python code in test files.

Answered

The python inspector does not throw warnings about the "PEP 8 coding style guide. Expected 2 blank lines" in the test files.

Is this the correct place to report this kind of bugs?

For example my inspection code pass successful in the file "test_something.py" but should be fails and show the double break line warning:

class TextWhatEver(TestCase):

def test_one(self):
pass

def test_two(self):
pass
5 comments

I was able to fix this by adding a "Local Python SDK".

I did this by going to "File -> Project Structure -> Project -> Project SDK -> New -> Python SDK -> Add Local", and pointing to my local Python installation.

Previously I only had a remote Python interpreter setup, and pep8 warnings weren't showing up properly.

0

Hi! Hm, example code looks ok for me, where do you expect additional blank lines? What Python version do you use?

0

I'll try the @Julian's solution and post the results.

@Pavel, the problem is about the PEP 8 code style, for example if you put this code in production instead of test then runs your the auto formatter it should be put two blank lines above `def test_two` instead of one.

Maybe today when I'll arrive to my apartment I'll record some video with the examples.

0

Dumb, dumb.

I was wrong... 

Using the reformat format (Code -> Reformat Code).

If I have this code:

class what_ever:
def test_one(self):
pass
def test_two(self):
pass

then I reformat the code (Ctrl+Alt+L), it formatted like that:

class what_ever:
def test_one(self):
pass

def test_two(self):
pass

One vertical space between `pass` and `def test_two`.

But if I don't have a class and only has the functions like this:

def test_one(self):
pass
def test_two(self):
pass

then I use the reformat code it created two vertical spaces between `pass` and `def test_two`.

def test_one(self):
pass


def test_two(self):
pass

 

Thanks for advance,

ad sorry for waste your time.

0

Please sign in to leave a comment.