Skip to content

Commit

Permalink
Update github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
lieryan committed Apr 4, 2024
1 parent 3ad5861 commit 2715c2f
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: psf/black@stable
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# **Upcoming release**

- #786 Upgrade Actions used in Github Workflows (@lieryan)
- #785 Refactoring movetest.py (@lieryan)

# Release 1.13.0
Expand Down
40 changes: 40 additions & 0 deletions ropetest/refactor/movetest.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,25 @@ class AClass(object):
self.mod3.read(),
)

def test_changing_other_modules_replacing_from_imports(self) -> None:
"""When moving a class from origin_module to destination_module, references to the class in mod3 is updated to point to destination_module"""
self.origin_module.write(dedent("""\
class AClass(object):
pass
"""))
self.mod3.write(dedent("""\
from origin_module import AClass
a_var = AClass()
"""))
self._move(self.origin_module, self.origin_module.read().index("AClass") + 1, self.destination_module)
self.assertEqual(
dedent("""\
from destination_module import AClass
a_var = AClass()
"""),
self.mod3.read(),
)

def test_changing_other_modules_adding_normal_imports(self) -> None:
self.origin_module.write(dedent("""\
class AClass(object):
Expand All @@ -231,6 +250,27 @@ def a_function():
self.mod3.read(),
)

def test_changing_other_modules_adding_from_imports(self) -> None:
self.origin_module.write(dedent("""\
class AClass(object):
pass
def a_function():
pass
"""))
self.mod3.write(dedent("""\
from origin_module import AClass, a_function
a_var = AClass()
a_function()"""))
self._move(self.origin_module, self.origin_module.read().index("AClass") + 1, self.destination_module)
self.assertEqual(
dedent("""\
from origin_module import a_function
from destination_module import AClass
a_var = AClass()
a_function()"""),
self.mod3.read(),
)

def test_adding_imports_prefer_from_module(self) -> None:
self.project.prefs["prefer_module_from_imports"] = True
self.origin_module.write(dedent("""\
Expand Down

0 comments on commit 2715c2f

Please sign in to comment.