Skip to content

Code action tests fail when global pyproject file exists #26

@rharish101

Description

@rharish101

I get the following in test_ruff_code_actions:

workspace = <pylsp.workspace.Workspace object at 0x7f0938b57130>

    def test_ruff_code_actions(workspace):
        _, doc = temp_document(codeaction_str, workspace)

        diags = ruff_lint.pylsp_lint(workspace, doc)
        range_ = cattrs.unstructure(
            Range(start=Position(line=0, character=0), end=Position(line=0, character=0))
        )
        actions = ruff_lint.pylsp_code_actions(
            workspace._config, workspace, doc, range=range_, context={"diagnostics": diags}
        )
        actions = converter.structure(actions, List[CodeAction])
        for action in actions:
>           assert action.title in codeactions
E           AssertionError: assert 'Ruff: Organize imports' in ['Ruff (F401): Remove unused import: `os`', 'Ruff (F401): Disable for this line', 'Ruff (F841): Remove assignment to unused variable `a`', 'Ruff (F841): Disable for this line', 'Ruff: Fix All']
E            +  where 'Ruff: Organize imports' = CodeAction(title='Ruff: Organize imports', kind=<CodeActionKind.SourceOrganizeImports: 'source.organizeImports'>, diag...range=1:0-2:0, new_text='import os\n\n\n')]}, document_changes=None, change_annotations=None), command=None, data=None).title

tests/test_code_actions.py:76: AssertionError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions