Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@ jobs:
pip install black==22.6.0
pip install pytest
pip install PyYAML
pip install setuptools
- name: validate-style
run: |
make validate-style

- name: Tests
run: |
run: pytest tests/


4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
version="1.0.2",
packages=find_packages(exclude=["tests*"]),
install_requires=["antlr4-python3-runtime>=4.10"],
tests_require=["pytest", "PyYAML"],
setup_requires=["flake8", "black"],
tests_require=["pytest", "PyYAML", "setuptools"],
setup_requires=["flake8", "black", "setuptools"],
entry_points={
"console_scripts": [
"promformat = promformat.__main__:main",
Expand Down
9 changes: 4 additions & 5 deletions tests/test_formatter.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from importlib.resources import files
from random import randint

import antlr4
import pkg_resources
import yaml
import pytest
from antlr4 import CommonTokenStream
Expand All @@ -11,7 +11,6 @@
import hashlib
import os

import pkg_resources
import yaml
import pytest

Expand All @@ -20,8 +19,8 @@


def get_rules():
rule_path = pkg_resources.resource_filename("tests.resources", "test-promql.yaml")
with open(rule_path) as f:
rule_path = files("tests.resources") / "test-promql.yaml"
with open(str(rule_path)) as f:
data = yaml.safe_load(f)
for group in data["groups"]:
for service in group["services"]:
Expand Down Expand Up @@ -117,7 +116,7 @@ def test_comments(query: str):
],
)
def test_formatter(query, file_name):
rule_path = pkg_resources.resource_filename("tests.resources", "formatted")
rule_path = str(files("tests.resources") / "formatted")
path = os.path.join(rule_path, file_name)
with open(path) as f:
expected_formatting = f.read()
Expand Down