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

Mega refactor beta1 #108

Closed
wants to merge 20 commits into from
Closed
25 changes: 25 additions & 0 deletions .github/workflows/test-linux.yml
@@ -0,0 +1,25 @@
name: Linux Tests

on: [push]

jobs:
build:
name: Pruebitas en Linux
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8]

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Prepare Environment
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: PEP8
run: |
make pep8
25 changes: 25 additions & 0 deletions .github/workflows/test-windows.yml
@@ -0,0 +1,25 @@
name: Windows Tests

on: [push]

jobs:
build:
name: Pruebitas en Win
runs-on: windows-latest
strategy:
matrix:
python-version: [3.7, 3.8]

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Prepare Environment
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: PEP8
run: |
pycodestyle pireal
26 changes: 14 additions & 12 deletions .travis.yml
Expand Up @@ -2,19 +2,21 @@ language: python

python: 3.7

os: linux
dist: xenial

services:
- xvfb

cache: pip

installation_on_windows: &installation_on_windows
installation_on_windows:
- &installation_on_windows
before_install:
- choco install python --version 3.7.4
- python --version
- python -m pip install --upgrade pip
- pip3 install --upgrade pytest ordered-set
- pip3 install --upgrade pyqt5 pytest pytest-qt ordered-set

install: pip --version # Avoid install with pip install -r requirements.txt

Expand Down Expand Up @@ -47,7 +49,7 @@ jobs:
name: unit test
before_install:
- pip install pip --upgrade
- pip install pytest pytest-cov ordered-set
- pip install pyqt5 pytest pytest-cov ordered-set
script: make test

- stage: Test
Expand All @@ -66,18 +68,22 @@ jobs:
- libxkbcommon-x11-0
name: unit test user interface
before_install:
- pip install pyqt5 pytest pytest-qt ordered-set
- pip install pip --upgrade
- pip install pyqt5 pytest pytest-mock pytest-qt ordered-set
script: make test-gui
if: type = pull_request

- stage: Integration Test
addons:
apt:
packages:
- x11-utils
- libxkbcommon-x11-0
name: integration test
before_install:
- pip install pip --upgrade
- pip install pytest ordered-set
- pip install pyqt5 pytest pytest-qt ordered-set
before_script: make clean
script: make test-integration
if: type = pull_request

- stage: Integration Test
name: integration test on Windows
Expand All @@ -86,14 +92,10 @@ jobs:
<<: *installation_on_windows
env: PATH=/c/Python37:/c/Python37/Scripts:$PATH
script: pytest tests -m integration --ignore=tests/gui
if: type = pull_request

- stage: Coverage
name: coverage
before_install:
- pip install pip --upgrade
- pip install pytest
- pip install pytest-cov
- pip install coveralls
- pip install ordered-set
- pip install pytest pytest-cov coveralls ordered-set
script: coveralls
6 changes: 5 additions & 1 deletion Makefile
Expand Up @@ -7,6 +7,7 @@ help:
@echo "pep8 \t\t run pycodestyle"
@echo "flake8 \t run flake8"
@echo "lint \t\t run pycodestyle and flake8"
@echo "pipeline \t run all kind of tests and lints"
@echo "dist \t\t run python setup.py sdist"
@echo "deb \t\t build a .deb package"
@echo "install \t run python setup.py install"
Expand All @@ -30,7 +31,7 @@ pep8:
pycodestyle pireal

flake8:
flake8 pireal -v
flake8 pireal

lint: pep8 flake8

Expand All @@ -45,6 +46,9 @@ test-gui:

test-integration:
@$(PYTEST) -v -m integration --ignore=tests/gui

pipeline: lint test test-gui test-integration

dist: clean
python setup.py sdist
mv dist/* ../
Expand Down
1 change: 0 additions & 1 deletion README.md
@@ -1,6 +1,5 @@

[![Build Status](https://travis-ci.org/centaurialpha/pireal.svg?branch=develop)](https://travis-ci.org/centaurialpha/pireal)
[![Workflow](https://github.com/centaurialpha/pireal/workflows/Main%20Workflow/badge.svg)](https://github.com/centaurialpha/pireal)
[![Coverage Status](https://coveralls.io/repos/github/centaurialpha/pireal/badge.svg?branch=develop)](https://coveralls.io/github/centaurialpha/pireal?branch=develop)
---

Expand Down
34 changes: 17 additions & 17 deletions bin/pireal
@@ -1,7 +1,7 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# Copyright 2015-2019 Gabriel Acosta <acostadariogabriel@gmail.com>
# Copyright 2015-2020 Gabriel Acosta <acostadariogabriel@gmail.com>
#
# This file is part of Pireal.
#
Expand All @@ -22,20 +22,20 @@

import os
import sys
import ctypes
# import ctypes


def create_dirs():
"""This functions create a structure folders used by Pireal"""
# def create_dirs():
# """This functions create a structure folders used by Pireal"""

pireal_dir = settings.PIREAL_DIR
is_win = settings.WINDOWS
for path in (pireal_dir, settings.PIREAL_DATABASES, settings.LOGS_PATH):
if not os.path.isdir(path):
os.mkdir(path)
if path == pireal_dir and is_win:
# Set hide attribute if OS is WIndows
ctypes.windll.kernel32.SetFileAttributesW(path, 0x02)
# pireal_dir = settings.PIREAL_DIR
# is_win = settings.IS_WINDOWS
# for path in (pireal_dir, settings.PIREAL_DATABASES, settings.LOGS_PATH):
# if not os.path.isdir(path):
# os.mkdir(path)
# if path == pireal_dir and is_win:
# # Set hide attribute if OS is WIndows
# ctypes.windll.kernel32.SetFileAttributesW(path, 0x02)


# Esto es reemplazado en tiempo de instalación
Expand All @@ -51,22 +51,22 @@ if project_base_dir not in sys.path:

from pireal.core import cliparser # noqa
from pireal import __version__ # noqa
from pireal.dirs import create_app_dirs # noqa
from pireal.core import settings # noqa

# Parse CLI
args = cliparser.get_cli().parse_args()

if args.version:
print(__version__)
sys.exit(0)

# Creo los dirs antes de leer logs see #84
create_dirs()
# Creo los dirs antes de leer logs. see #84
create_app_dirs()

from pireal.core import logger # noqa
from pireal import main # noqa
from pireal import resources # noqa
# Set up logger
logger.set_up(args.verbose)
logger.set_up(debug=args.debug, verbose=args.verbose)

main.start_pireal()
main.start_pireal(args)
4 changes: 3 additions & 1 deletion pireal/core/cliparser.py
Expand Up @@ -22,7 +22,9 @@

def get_cli():
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--database', help='Database file')
parser.add_argument('-d', '--debug', action='store_true', help='Debug')
parser.add_argument('-v', '--verbose', action='store_true', help='Verbose')
parser.add_argument('--database', help='Database file')
parser.add_argument('--version', action='store_true', help='Version')
parser.add_argument('--no-check-updates', action='store_true', help='Disable check updates')
return parser
12 changes: 12 additions & 0 deletions pireal/gui/query_container/__init__.py → pireal/core/config.py
Expand Up @@ -16,3 +16,15 @@
#
# You should have received a copy of the GNU General Public License
# along with Pireal; If not, see <http://www.gnu.org/licenses/>.

"""The configuration"""
import configparser


OPTIONS = {

}


class Config:
pass