Skip to content

Commit

Permalink
refactor(tests): better mark for pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
centaurialpha committed Aug 27, 2022
1 parent bbdedef commit c2c71b2
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 86 deletions.
21 changes: 7 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
PYTEST = pytest tests

help:
@echo "test -- run tests"
@echo "test-gui -- run tests for GUI"
@echo "test -- run tests"
@echo "test-unit -- run unit tests"
@echo "test-interpreter -- run tests for Scanner, Lexer, Parser and Interpreter"
@echo "test-integration -- run integration tests"
@echo "flake8 -- run flake8"
@echo "dist -- run python setup.py sdist"
@echo "deb -- build a .deb package"
@echo "rc -- buil resources"
@echo "flake8 -- run flake8"
@echo "deb -- build a .deb package"

rc:
pyrcc5 pireal/resources/resources.qrc -o pireal/resources.py

clean:
rm -rf `find -name "*pyc"`
rm -rf `find -name "*pyo"`
rm -rf .pybuild/
rm -rf debian/debhelper-build-stamp
rm -rf debian/.debhelper
Expand All @@ -38,18 +35,14 @@ format:
test-unit:
pytest -v tests/unit --cov pireal --cov-report term-missing

test-gui:
@$(PYTEST) -v -m gui
test-interpreter:
python -m pytest -v -m interpreter --cov=pireal.interpreter --cov-report term-missing

test-integration:
pytest -v tests/integration -s

test: test-unit test-integration

dist: clean
python setup.py sdist
mv dist/* ../

deb:
debuild -b -uc -us

Expand Down
3 changes: 3 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[pytest]
markers =
interpreter: mark a test as a interpreter.
66 changes: 0 additions & 66 deletions tests/unit/test_interpreter.py

This file was deleted.

5 changes: 2 additions & 3 deletions tests/unit/test_lexer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import unittest
import datetime

import pytest

from pireal.interpreter.lexer import (
Expand All @@ -11,6 +8,8 @@
from pireal.interpreter.tokens import TokenTypes
from pireal.interpreter.scanner import Scanner

pytestmark = pytest.mark.interpreter


@pytest.fixture()
def lexer():
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
from pireal.interpreter.lexer import Lexer, Token
from pireal.interpreter.parser import Parser, Interpreter
from pireal.interpreter import rast as ast
from pireal.interpreter.tokens import TokenTypes, BINARY_OPERATORS
from pireal.interpreter.tokens import TokenTypes
from pireal.interpreter.exceptions import ConsumeError

pytestmark = pytest.mark.interpreter


def test_mix_boolean_expression():
query = "name = 'gabox' or age >= 18 and age <= 30"
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
"""Test para el Scanner"""

import pytest
import unittest

from pireal.interpreter.scanner import Scanner
from pireal.interpreter import scanner

pytestmark = pytest.mark.interpreter


@pytest.fixture
def scanner_bot():
Expand Down

0 comments on commit c2c71b2

Please sign in to comment.