Skip to content
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

updated ci/cd #2

Merged
merged 6 commits into from
Jul 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -13,15 +13,26 @@ permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
Testing:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.8, 3.9,"3.10", "3.11", "3.12"]
os: [ubuntu-latest, macOS-latest, windows-latest]

steps:
- uses: actions/checkout@v4
- name: Setup PDM
- name: Set up PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: pdm install && pip install ruff
run: |
pdm install ; pip install ruff pytest
- name: Run Tests
run: |
pdm run -v pytest tests
- name: Lint with ruff
run: |
ruff check .
58 changes: 54 additions & 4 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -21,9 +21,8 @@ build-backend = "pdm.backend"
distribution = true

[tool.pdm.dev-dependencies]
lint = [
"ruff>=0.5.0",
]
lint = ["ruff>=0.5.0"]
tests = ["pytest>=8.2.2"]

[project.scripts]
pyfix-imports = "pyfix_imports.commandline.cli:cli"
pyfix-imports = "pyfix_imports.commandline.cli:cli"
15 changes: 15 additions & 0 deletions tests/mod_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from pyfix_imports.pyflake import pyflake
from tests.test import test_code

def check_code(output):
mod_list = pyflake(output)

if mod_list:
return mod_list
else:
return {}


def test_code_output():
assert check_code(test_code) == {'defaultdict', 'Tuple', 'List', 'mp', 'Optional', 'time', 'np', 'deque', 'os', 'itertools', 'Dict', 'dedent', 'collections', 'random'}

32 changes: 32 additions & 0 deletions tests/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
test_code = """
start = time.time()
a = np.array([1, 2, 3, 4])
b = os.getcwd()


c = random.randint(1, 3)

deq = deque()
a = dedent("121")
d = defaultdict(str)

a = mp.sqrt_mod(12, 2)

itt = itertools.accumulate([1, 2, 3, 4])

print(list(itt))

assert list(itt) == [1, 3, 6, 10]

Points = collections.namedtuple("Point", ["x", "y"])


def fname(a: Dict[int, List], b: Tuple[int], c: Optional[List]):
pass


z = os.getcwd()

end = time.time()
print(end - start)
"""
Loading