Skip to content

passing -t flag in python.unitTest.unittestArgs doesn't propagate to unittest module #2162

@bondar

Description

@bondar

Environment data

  • VS Code version: 1.25.1
  • Extension version (available under the Extensions sidebar): 2018.6.0
  • OS and version: OSX 10.13.3
  • Python version (& distribution if applicable, e.g. Anaconda): 2.7.14
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): n/a
  • Relevant/affected Python packages and their versions: unittest (part of python)

Actual behavior

This documentation says that I can use:

	"python.unitTest.unittestArgs": [
		"-t",
		"../../",
		"-s", 
		"python/tests/",
		"-p",
		"*_test.py",
	]

Unfortunately, -t has no affect...

Also, I suspect python.unitTest.cwd does nothing...

I verified that by looking into this file in the repo

Expected behavior

-t should be propagate to unittest and set the top level directory as described in python unittest
cwd should also affect the directory that the unittest was launched

Steps to reproduce:

  1. Create a multi-root workspace of:
Root
|- package A (workspace 1)
|- package B (workspace 2)
    |- tests
  1. Create a test that depends (relative import) on package A
  2. configure unit tests specifically for the workspace 2 directory
  3. Run the tests and you'll get "ValueError: Attempted relative import in non-package"
  4. add -t and see that it has no affect
  5. change cwd and also doesn't make any affect

Logs

Nothing in Output or in Dev tools...

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-testingbugIssue identified by VS Code Team member as probable bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions