Skip to content

python extension fails to discover test files #1613

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

Closed
camelator opened this issue May 8, 2020 · 11 comments
Closed

python extension fails to discover test files #1613

camelator opened this issue May 8, 2020 · 11 comments

Comments

@camelator
Copy link

camelator commented May 8, 2020

I have the last version of code-servfer installed on ARM64 machine inside a Docker image based on Debian.
Everything look working fine.
Python extension is working fine except for unit tests:

inside a new folder, i created a sub folder 'test'
inside this sub folder, I create a simple testAbc.py
import unittest

import unittest

class TestAbc(unittest.TestCase):
def test1(self):
self.assertEqual(0,0)

if name == 'main':
unittest.main()

Then I run the command Python: Configure tests , choose unittest, I choose folder test, and tests like that: test*.py

The test icon on the panel is not displayed (it is displayed on studio code)

then I run the command: Python: Discover tests => no results

What is strange is by changing the test api to pytest, i succeed to have the test icon displayed, but again no tests found using command Discover tests.

please can you help?

@cmoog
Copy link
Contributor

cmoog commented May 14, 2020

It's very unlikely that this is a problem with code-server. My guess is that there is an issue with the python configuration within your Docker container.

@nhooyr
Copy link
Contributor

nhooyr commented May 18, 2020

Yes, please try to reproduce with normal VS Code and if it's not an issue there, I'll reopen.

@nhooyr nhooyr closed this as completed May 18, 2020
@camelator
Copy link
Author

I tried the same python file on 3 different environment, and here is what I have:
VS Code: No issue
Code-Server on x86 : no issue (with original docker file)
Code-Server on ARM: issue with unittest framework (pytest works better)

I tried several actions to understand what can be the problem, and I think with unittest framework on ARM there is an issue with the discovery function:

make a simple test test_hello.py
Configure test framework with pytest
Discover tests : everything works, and I can go to the test panel, there is the file test_hello
Then, I changed the test framework to unittest with 'Configure Test Framework'
Then, I simply rename the file to anything.py in the explorer
Then Discover tests: the file 'test_hello' is still present in the test panel (but not in the explorer planel)
Then I reload firefox, and now there is no tests....
This is very strange.

@nhooyr
Copy link
Contributor

nhooyr commented May 19, 2020

I'd recommend filing a bug with unittest.

@camelator
Copy link
Author

Not sure, as reloading prove it works, and it is the automatic refresh that does not work.

@nhooyr
Copy link
Contributor

nhooyr commented May 19, 2020

Can you record a video or show how to reproduce it step by step?

@nhooyr nhooyr reopened this May 19, 2020
@nhooyr
Copy link
Contributor

nhooyr commented May 19, 2020

Like what's in test_hello.py?

@nhooyr
Copy link
Contributor

nhooyr commented Jun 3, 2020

Closing for inactivity. Highly recommend filing a bug report against unittest as it's very unlikely to be a code-server bug.

@nhooyr nhooyr closed this as completed Jun 3, 2020
@WhitCrow
Copy link

WhitCrow commented Sep 11, 2020

code-server: 3.5.0 on CentOs7 Offline environment

I have the same issue. I try to creat a helloWorld.py and helloWorld_test.py to test the available of unittest.

Python testing in Visual Studio Code

creat helloWord.py and helloWorld_test.py
Configure test framework with unitest
discover tests
no display

but it's worked in my vscode on win10

@code-asher
Copy link
Member

When I try to run tests I get this error: #1837 (but the activation works) so that might be why the discovery isn't working.

@WhitCrow
Copy link

When I try to run tests I get this error: #1837 (but the activation works) so that might be why the discovery isn't working.

i give up, use another test framwork pytest replaced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants