Skip to content
This repository has been archived by the owner on Jul 23, 2022. It is now read-only.

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpython committed Apr 22, 2019
1 parent 4c0c078 commit b4b807c
Show file tree
Hide file tree
Showing 29 changed files with 34 additions and 392 deletions.
7 changes: 5 additions & 2 deletions .circleci/config.yml
Expand Up @@ -2,7 +2,7 @@ version: 2
jobs:
build:
docker:
- image: circleci/python:3.7.0
- image: circleci/python:3.7.2

working_directory: ~/repo

Expand Down Expand Up @@ -72,12 +72,14 @@ jobs:
name: run tests
command: |
. venv/bin/activate
export PYTHONPATH=src
python setup.py unittests
- run:
name: wheel
command: |
. venv/bin/activate
export PYTHONPATH=src
python setup.py bdist_wheel
mkdir -p test-reports/dist
cp dist/*.whl test-reports/dist
Expand All @@ -86,6 +88,7 @@ jobs:
name: documentation
command: |
. venv/bin/activate
export PYTHONPATH=src
python setup.py build_sphinx
- run:
Expand All @@ -96,4 +99,4 @@ jobs:
- store_artifacts:
path: test-reports
destination: test-reports
destination: test-reports
2 changes: 1 addition & 1 deletion .local.jenkins.lin.yml
Expand Up @@ -2,7 +2,7 @@
language: python

python:
- { PATH: "{{Python37}}", VERSION: 3.7, DIST: std, PYINT: python3.7 }
- { PATH: "{{Python37}}", VERSION: 3.7, DIST: std, PYINT: python3.7, PYTHONPATH: src }

virtualenv:
- path: {{ospathjoin(root_path, pickname("$NAME_JENKINS", project_name + "_$VERSION_$DIST_$NAME"), "_venv")}}
Expand Down
2 changes: 1 addition & 1 deletion .local.jenkins.win.yml
@@ -1,6 +1,6 @@
language: python
python:
- { PATH: "{{replace(Python37, '\\', '\\\\')}}", VERSION: 3.7, DIST: std }
- { PATH: "{{replace(Python37, '\\', '\\\\')}}", VERSION: 3.7, DIST: std, PYTHONPATH: src }
virtualenv:
- path: {{ospathjoin(root_path, pickname("%NAME_JENKINS%", project_name + "_%VERSION%_%DIST%_%NAME%"), "_venv")}}
install:
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -25,5 +25,6 @@ install:
- pip install -r requirements.txt
- pip install -U git+https://github.com/quantopian/qgrid --no-deps
# - pip install hg+http://bitbucket.org/pygame/pygame
- export PYTHONPATH=src
script:
- python setup.py unittests
4 changes: 2 additions & 2 deletions _doc/sphinxdoc/source/conf.py
@@ -1,15 +1,15 @@
# -*- coding: utf-8 -*-
import sys
import os
import sphinx_modern_theme_modified
import sphinx_readable_theme
from pyquickhelper.helpgen.default_conf import set_sphinx_variables, get_default_stylesheet

sys.path.insert(0, os.path.abspath(os.path.join(os.path.split(__file__)[0])))
local_template = os.path.join(os.path.abspath(
os.path.dirname(__file__)), "phdoc_templates")

set_sphinx_variables(__file__, "mathenjeu", "Xavier Dupré", 2019,
"sphinx_modern_theme_modified", sphinx_modern_theme_modified.get_html_theme_path(),
"readable", sphinx_readable_theme.get_html_theme_path(),
locals(), extlinks=dict(
issue=('https://github.com/sdpython/mathenjeu/issues/%s', 'issue')),
title="Exercices via une application web", book=True, nblayout='table')
Expand Down
18 changes: 0 additions & 18 deletions _unittests/run_unittests.py

This file was deleted.

23 changes: 2 additions & 21 deletions _unittests/ut_activities/test_repr.py
@@ -1,29 +1,10 @@
"""
@brief test log(time=1s)
"""

import sys
import os
import unittest
from pyquickhelper.pycode import ExtTestCase


try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..")))
if path not in sys.path:
sys.path.append(path)
import src


from src.mathenjeu.activities import Display
from src.mathenjeu.tests import simple_french_qcm
from mathenjeu.activities import Display
from mathenjeu.tests import simple_french_qcm


class TestRepr(ExtTestCase):
Expand Down
20 changes: 1 addition & 19 deletions _unittests/ut_apps/test_qcm_app.py
Expand Up @@ -2,29 +2,11 @@
"""
@brief test log(time=33s)
"""

import sys
import os
import unittest
from starlette.testclient import TestClient
from uvicorn.middleware.proxy_headers import ProxyHeadersMiddleware
from pyquickhelper.pycode import get_temp_folder, ExtTestCase


try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..")))
if path not in sys.path:
sys.path.append(path)
import src

from src.mathenjeu.cli import create_qcm_local_app
from mathenjeu.cli import create_qcm_local_app


class TestQcmApp(ExtTestCase):
Expand Down
19 changes: 1 addition & 18 deletions _unittests/ut_apps/test_static_app.py
Expand Up @@ -2,29 +2,12 @@
"""
@brief test log(time=33s)
"""

import sys
import os
import unittest
from starlette.testclient import TestClient
from uvicorn.middleware.proxy_headers import ProxyHeadersMiddleware
from pyquickhelper.pycode import get_temp_folder, ExtTestCase


try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..")))
if path not in sys.path:
sys.path.append(path)
import src

from src.mathenjeu.cli import create_static_local_app
from mathenjeu.cli import create_static_local_app


class TestStaticApp(ExtTestCase):
Expand Down
23 changes: 1 addition & 22 deletions _unittests/ut_cli/test_cert.py
@@ -1,36 +1,15 @@
"""
@brief test tree node (time=2s)
"""


import sys
import os
import unittest
from pyquickhelper.pycode import get_temp_folder, ExtTestCase
from pyquickhelper.loghelper import BufferedPrint

try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..")))
if path not in sys.path:
sys.path.append(path)
import src

from src.mathenjeu.__main__ import main
from mathenjeu.__main__ import main


class TestCertCli(ExtTestCase):

def test_src_import(self):
"""for pylint"""
self.assertTrue(src is not None)

def test_cert(self):
st = BufferedPrint()
main(args=['create_self_signed_cert', '--help'], fLOG=st.fprint)
Expand Down
26 changes: 2 additions & 24 deletions _unittests/ut_cli/test_cli_helper.py
@@ -1,36 +1,14 @@
"""
@brief test tree node (time=1s)
"""


import sys
import os
import unittest
from pyquickhelper.pycode import ExtTestCase

try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..")))
if path not in sys.path:
sys.path.append(path)
import src

from src.mathenjeu.activities import ActivityGroup
from src.mathenjeu.cli.cli_helper import build_games
from mathenjeu.activities import ActivityGroup
from mathenjeu.cli.cli_helper import build_games


class TestCliHelper(ExtTestCase):

def test_src_import(self):
"""for pylint"""
self.assertTrue(src is not None)

def test_local_app(self):
script = "src.mathenjeu.tests.qcms.py:simple_french_qcm,Maths et QCM,0"
games, fct = build_games(script, None)
Expand Down
21 changes: 1 addition & 20 deletions _unittests/ut_cli/test_qcm_https_app.py
@@ -1,34 +1,15 @@
"""
@brief test tree node (time=2s)
"""
import sys
import os
import unittest
from pyquickhelper.pycode import get_temp_folder, ExtTestCase
from pyquickhelper.loghelper import BufferedPrint

try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..")))
if path not in sys.path:
sys.path.append(path)
import src

from src.mathenjeu.__main__ import main
from mathenjeu.__main__ import main


class TestQcmHttpsAppCli(ExtTestCase):

def test_src_import(self):
"""for pylint"""
self.assertTrue(src is not None)

def test_https_webapp(self):
st = BufferedPrint()
main(args=['qcm_https', '--help'], fLOG=st.fprint)
Expand Down
24 changes: 1 addition & 23 deletions _unittests/ut_cli/test_qcm_local_app.py
@@ -1,35 +1,13 @@
"""
@brief test tree node (time=2s)
"""


import sys
import os
import unittest
from pyquickhelper.loghelper import BufferedPrint

try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..")))
if path not in sys.path:
sys.path.append(path)
import src

from src.mathenjeu.__main__ import main
from mathenjeu.__main__ import main


class TestQcmLocalAppCli(unittest.TestCase):

def test_src_import(self):
"""for pylint"""
self.assertTrue(src is not None)

def test_local_app(self):
st = BufferedPrint()
main(args=[], fLOG=st.fprint)
Expand Down
21 changes: 1 addition & 20 deletions _unittests/ut_cli/test_static_https_app.py
@@ -1,34 +1,15 @@
"""
@brief test tree node (time=2s)
"""
import sys
import os
import unittest
from pyquickhelper.pycode import get_temp_folder, ExtTestCase
from pyquickhelper.loghelper import BufferedPrint

try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..")))
if path not in sys.path:
sys.path.append(path)
import src

from src.mathenjeu.__main__ import main
from mathenjeu.__main__ import main


class TestQcmHttpsAppCli(ExtTestCase):

def test_src_import(self):
"""for pylint"""
self.assertTrue(src is not None)

def test_https_webapp(self):
st = BufferedPrint()
main(args=['qcm_https', '--help'], fLOG=st.fprint)
Expand Down

0 comments on commit b4b807c

Please sign in to comment.