Skip to content

Commit

Permalink
Add black formatter (#2)
Browse files Browse the repository at this point in the history
* black formatter in Github Actions

* code formatted

---------

Co-authored-by: GitHub Action <action@github.com>
  • Loading branch information
0xnabil and actions-user authored Mar 4, 2024
1 parent aca7150 commit 8799dd1
Show file tree
Hide file tree
Showing 9 changed files with 241 additions and 140 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: run python script

on:
schedule:
- cron: '0 14 * * *'
- cron: '0 8,14 * * *'

jobs:
build:
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,25 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Check files using the black formatter
uses: psf/black@stable
id: action_black
with:
options: "."

- name: commit files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add -A
git diff-index --quiet HEAD || (git commit -a -m "code formatted" --allow-empty)
- name: push changes
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref || github.ref_name }}

- name: run pytest
id: test_step
run: pytest tests
Expand Down
15 changes: 8 additions & 7 deletions tests/test_helpers.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import pytest
import sys
import os
import os

sys.path.append(os.path.dirname(os.path.dirname(__file__)) + "/trending-pools")

from helpers import parse_token_id


@pytest.mark.parametrize(
"id, chain_and_address",
[
("polygon_pos_0xCrazyShitcoin0", ("polygon_pos", "0xCrazyShitcoin0")),
("eth_0xCrazyShitcoin1", ("eth", "0xCrazyShitcoin1")),
("eth-goerli_0xCrazyShitcoin2", ("eth-goerli", "0xCrazyShitcoin2")),
]
"id, chain_and_address",
[
("polygon_pos_0xCrazyShitcoin0", ("polygon_pos", "0xCrazyShitcoin0")),
("eth_0xCrazyShitcoin1", ("eth", "0xCrazyShitcoin1")),
("eth-goerli_0xCrazyShitcoin2", ("eth-goerli", "0xCrazyShitcoin2")),
],
)
def test_parse_token_id(id, chain_and_address):
assert parse_token_id(id) == chain_and_address
Loading

0 comments on commit 8799dd1

Please sign in to comment.