diff --git a/.gitea/workflows/tests.yml b/.gitea/workflows/tests.yml new file mode 100644 index 0000000..3bb6bde --- /dev/null +++ b/.gitea/workflows/tests.yml @@ -0,0 +1,34 @@ +name: Tests + +on: + push: + branches: + - dev + - main + tags-ignore: + - v* + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + container: catthehacker/ubuntu:act-latest + strategy: + matrix: + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + env: + AGENT_TOOLSDIRECTORY: /opt/hostedtoolcache + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox tox-gh-actions + - name: Test with tox + run: tox + diff --git a/.gitignore b/.gitignore index 84e89d4..b34c603 100644 --- a/.gitignore +++ b/.gitignore @@ -154,12 +154,9 @@ cython_debug/ # Custom -.pypirc -tests -test.bat -test_key.json -build.* -cleanup.* -publish.* -publish-release.* -.vscode \ No newline at end of file +.vscode/ +.venv_linux/ +.venv_windows/ + +# Module-related +tests/output/ \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..4445954 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,69 @@ +[build-system] +requires = ["setuptools>=52.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "pyrmv" +dynamic = ["version", "dependencies", "optional-dependencies"] +authors = [{ name = "Profitroll", email = "profitroll@end-play.xyz" }] +maintainers = [{ name = "Profitroll", email = "profitroll@end-play.xyz" }] +description = "Small module that makes your journey with RMV REST API somehow easier." +readme = "README.md" +requires-python = ">=3.8" +license = { text = "GPL3" } +classifiers = [ + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Utilities", +] + +[project.urls] +Homepage = "https://git.end-play.xyz/profitroll/PythonRMV" +Source = "https://git.end-play.xyz/profitroll/PythonRMV" +Tracker = "https://git.end-play.xyz/profitroll/PythonRMV/issues" +Documentation = "https://git.end-play.xyz/profitroll/PythonRMV/wiki" + + +[tool.setuptools.dynamic] +version = { attr = "pyrmv.__version__" } +dependencies = { file = "requirements/_.txt" } + +[tool.setuptools.dynamic.optional-dependencies] +dev = { file = "requirements/dev.txt" } + +[tool.setuptools.packages.find] +where = ["src"] + +[tool.black] +target-version = ['py38', 'py39', 'py310', 'py311'] + +[tool.isort] +profile = "black" + +[tool.pytest.ini_options] +minversion = "6.0" +python_files = ["test_*.py"] +pythonpath = "." +testpaths = ["tests"] + +[tool.mypy] +namespace_packages = true +install_types = true +strict = true +show_error_codes = true + +[tool.pylint.main] +extension-pkg-whitelist = ["ujson"] +py-version = 3.8 + +[tool.coverage.run] +source = ["libbot"] diff --git a/requirements.txt b/requirements/_.txt similarity index 100% rename from requirements.txt rename to requirements/_.txt diff --git a/requirements/dev.txt b/requirements/dev.txt new file mode 100644 index 0000000..4e999c4 --- /dev/null +++ b/requirements/dev.txt @@ -0,0 +1,12 @@ +black==23.11.0 +build==1.0.3 +isort==5.12.0 +mypy==1.7.0 +pylint==3.0.2 +pytest-asyncio==0.22.0 +pytest-cov==4.1.0 +pytest==7.4.3 +tox==4.11.3 +twine==4.0.2 +types-aiofiles==23.2.0.0 +types-ujson==5.8.0.1 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index fe869c8..0000000 --- a/setup.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[metadata] -description_file=README.md -license_files=LICENSE \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index 77cff13..0000000 --- a/setup.py +++ /dev/null @@ -1,36 +0,0 @@ -from setuptools import setup - -setup( - name="pyrmv", - version="0.3.5", - author="Profitroll", - description="Small module that makes your journey with RMV REST API somehow easier.", - long_description="Small module that makes your journey with RMV REST API somehow easier. Based fully on official RMV API reference and HAFAS documentation.\n\n## Requirements\n\n* RMV API key (Get it [here](https://opendata.rmv.de/site/start.html))\n* Python3 (Tested versions are 3.7.9 and 3.9.13)\n* git (Only for installation from source)\n\n## Installation\n\nIf you have everything listed in [requirements](#requirements), then let's begin.\n\n### Variant 1\n\n1. `python -m pip install pyrmv`\n\n### Variant 2\n\n1. `git clone https://git.end-play.xyz/profitroll/PythonRMV.git`\n2. `cd PythonRMV`\n3. `python setup.py install`\n\n## Usage\n\n```py\nimport pyrmv\n\n# Define a Client with API key\nclient = pyrmv.Client(\"AcessId\")\n\n# Get origin's and destination's location\norigin = client.stop_by_name(\"Frankfurt Hauptbahnhof\", max_number=3)[0]\ndestination = client.stop_by_coords(50.099613, 8.685449, max_number=3)[0]\n\n# Find a trip by locations got\ntrip = client.trip_find(origin_id=origin.id, dest_id=destination.id)\n```\n\n## Frequently Asked Questions\n\n* [Why are there raw versions and formatted ones?](#why-are-there-raw-versions-and-formatted-ones)\n* [Some methods work slightly different](#some-methods-work-slightly-different)\n\n### Why are there raw versions and formatted ones?\n\nFor the purposes of my projects I don't really need all the stuff RMV gives (even though it's not much).\nI only need some specific things. However I do understand that in some cases other users may find\nthose methods quite useful so I implemented them as well.\n\n### Some methods work slightly different\n\nCan be. Not all function arguments written may work perfectly because I simply did not test each and\nevery request. Some of arguments may be irrelevant in my use-case and the others are used quite rare at all.\nJust [make an issue](https://git.end-play.xyz/profitroll/PythonRMV/issues/new) and I'll implement it correct when I'll have some free time.\n\n## To-Do\n\n### General\n\n* [ ] Docs in Wiki\n* [ ] Tickets", - long_description_content_type="text/markdown", - author_email="profitroll@end-play.xyz", - url="https://git.end-play.xyz/profitroll/PythonRMV", - project_urls={ - "Bug Tracker": "https://git.end-play.xyz/profitroll/PythonRMV/issues", - "Documentation": "https://git.end-play.xyz/profitroll/PythonRMV/wiki", - "Source Code": "https://git.end-play.xyz/profitroll/PythonRMV.git", - }, - packages=[ - "pyrmv", - "pyrmv.raw", - "pyrmv.const", - "pyrmv.enums", - "pyrmv.errors", - "pyrmv.utility", - "pyrmv.classes", - ], - install_requires=["requests", "xmltodict", "isodate"], - classifiers=[ - "Development Status :: 3 - Alpha", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Programming Language :: Python :: 3", - "Topic :: Software Development :: Libraries :: Python Modules", - "Topic :: Utilities", - ], -) diff --git a/pyrmv/__init__.py b/src/pyrmv/__init__.py similarity index 97% rename from pyrmv/__init__.py rename to src/pyrmv/__init__.py index b107229..8ecd27d 100644 --- a/pyrmv/__init__.py +++ b/src/pyrmv/__init__.py @@ -21,7 +21,7 @@ trip = client.trip_find(origin_id=origin.id, dest_id=destination.id) """ __name__ = "pyrmv" -__version__ = "0.3.5" +__version__ = "0.3.6" __license__ = "MIT License" __author__ = "Profitroll" diff --git a/pyrmv/classes/Board.py b/src/pyrmv/classes/Board.py similarity index 100% rename from pyrmv/classes/Board.py rename to src/pyrmv/classes/Board.py diff --git a/pyrmv/classes/Client.py b/src/pyrmv/classes/Client.py similarity index 100% rename from pyrmv/classes/Client.py rename to src/pyrmv/classes/Client.py diff --git a/pyrmv/classes/Gis.py b/src/pyrmv/classes/Gis.py similarity index 100% rename from pyrmv/classes/Gis.py rename to src/pyrmv/classes/Gis.py diff --git a/pyrmv/classes/Journey.py b/src/pyrmv/classes/Journey.py similarity index 100% rename from pyrmv/classes/Journey.py rename to src/pyrmv/classes/Journey.py diff --git a/pyrmv/classes/Leg.py b/src/pyrmv/classes/Leg.py similarity index 100% rename from pyrmv/classes/Leg.py rename to src/pyrmv/classes/Leg.py diff --git a/pyrmv/classes/Message.py b/src/pyrmv/classes/Message.py similarity index 100% rename from pyrmv/classes/Message.py rename to src/pyrmv/classes/Message.py diff --git a/pyrmv/classes/Stop.py b/src/pyrmv/classes/Stop.py similarity index 100% rename from pyrmv/classes/Stop.py rename to src/pyrmv/classes/Stop.py diff --git a/pyrmv/classes/Ticket.py b/src/pyrmv/classes/Ticket.py similarity index 100% rename from pyrmv/classes/Ticket.py rename to src/pyrmv/classes/Ticket.py diff --git a/pyrmv/classes/Trip.py b/src/pyrmv/classes/Trip.py similarity index 100% rename from pyrmv/classes/Trip.py rename to src/pyrmv/classes/Trip.py diff --git a/pyrmv/classes/__init__.py b/src/pyrmv/classes/__init__.py similarity index 100% rename from pyrmv/classes/__init__.py rename to src/pyrmv/classes/__init__.py diff --git a/pyrmv/const/__init__.py b/src/pyrmv/const/__init__.py similarity index 100% rename from pyrmv/const/__init__.py rename to src/pyrmv/const/__init__.py diff --git a/pyrmv/const/product.py b/src/pyrmv/const/product.py similarity index 100% rename from pyrmv/const/product.py rename to src/pyrmv/const/product.py diff --git a/pyrmv/enums/__init__.py b/src/pyrmv/enums/__init__.py similarity index 100% rename from pyrmv/enums/__init__.py rename to src/pyrmv/enums/__init__.py diff --git a/pyrmv/enums/aff_journey_mode.py b/src/pyrmv/enums/aff_journey_mode.py similarity index 100% rename from pyrmv/enums/aff_journey_mode.py rename to src/pyrmv/enums/aff_journey_mode.py diff --git a/pyrmv/enums/aff_journey_stop_mode.py b/src/pyrmv/enums/aff_journey_stop_mode.py similarity index 100% rename from pyrmv/enums/aff_journey_stop_mode.py rename to src/pyrmv/enums/aff_journey_stop_mode.py diff --git a/pyrmv/enums/auto_name.py b/src/pyrmv/enums/auto_name.py similarity index 100% rename from pyrmv/enums/auto_name.py rename to src/pyrmv/enums/auto_name.py diff --git a/pyrmv/enums/board_type.py b/src/pyrmv/enums/board_type.py similarity index 100% rename from pyrmv/enums/board_type.py rename to src/pyrmv/enums/board_type.py diff --git a/pyrmv/enums/filter_mode.py b/src/pyrmv/enums/filter_mode.py similarity index 100% rename from pyrmv/enums/filter_mode.py rename to src/pyrmv/enums/filter_mode.py diff --git a/pyrmv/enums/lang.py b/src/pyrmv/enums/lang.py similarity index 100% rename from pyrmv/enums/lang.py rename to src/pyrmv/enums/lang.py diff --git a/pyrmv/enums/location_type.py b/src/pyrmv/enums/location_type.py similarity index 100% rename from pyrmv/enums/location_type.py rename to src/pyrmv/enums/location_type.py diff --git a/pyrmv/enums/product.py b/src/pyrmv/enums/product.py similarity index 100% rename from pyrmv/enums/product.py rename to src/pyrmv/enums/product.py diff --git a/pyrmv/enums/rt_mode.py b/src/pyrmv/enums/rt_mode.py similarity index 100% rename from pyrmv/enums/rt_mode.py rename to src/pyrmv/enums/rt_mode.py diff --git a/pyrmv/enums/search_mode.py b/src/pyrmv/enums/search_mode.py similarity index 100% rename from pyrmv/enums/search_mode.py rename to src/pyrmv/enums/search_mode.py diff --git a/pyrmv/enums/selection_mode.py b/src/pyrmv/enums/selection_mode.py similarity index 100% rename from pyrmv/enums/selection_mode.py rename to src/pyrmv/enums/selection_mode.py diff --git a/pyrmv/errors/__init__.py b/src/pyrmv/errors/__init__.py similarity index 100% rename from pyrmv/errors/__init__.py rename to src/pyrmv/errors/__init__.py diff --git a/pyrmv/errors/api_errors.py b/src/pyrmv/errors/api_errors.py similarity index 100% rename from pyrmv/errors/api_errors.py rename to src/pyrmv/errors/api_errors.py diff --git a/pyrmv/errors/int_errors.py b/src/pyrmv/errors/int_errors.py similarity index 100% rename from pyrmv/errors/int_errors.py rename to src/pyrmv/errors/int_errors.py diff --git a/pyrmv/errors/not_ready.py b/src/pyrmv/errors/not_ready.py similarity index 100% rename from pyrmv/errors/not_ready.py rename to src/pyrmv/errors/not_ready.py diff --git a/pyrmv/errors/ps_errors.py b/src/pyrmv/errors/ps_errors.py similarity index 100% rename from pyrmv/errors/ps_errors.py rename to src/pyrmv/errors/ps_errors.py diff --git a/pyrmv/errors/sot_errors.py b/src/pyrmv/errors/sot_errors.py similarity index 100% rename from pyrmv/errors/sot_errors.py rename to src/pyrmv/errors/sot_errors.py diff --git a/pyrmv/errors/svc_errors.py b/src/pyrmv/errors/svc_errors.py similarity index 100% rename from pyrmv/errors/svc_errors.py rename to src/pyrmv/errors/svc_errors.py diff --git a/pyrmv/errors/unknown_error.py b/src/pyrmv/errors/unknown_error.py similarity index 100% rename from pyrmv/errors/unknown_error.py rename to src/pyrmv/errors/unknown_error.py diff --git a/pyrmv/raw/__init__.py b/src/pyrmv/raw/__init__.py similarity index 100% rename from pyrmv/raw/__init__.py rename to src/pyrmv/raw/__init__.py diff --git a/pyrmv/raw/board_arrival.py b/src/pyrmv/raw/board_arrival.py similarity index 100% rename from pyrmv/raw/board_arrival.py rename to src/pyrmv/raw/board_arrival.py diff --git a/pyrmv/raw/board_departure.py b/src/pyrmv/raw/board_departure.py similarity index 100% rename from pyrmv/raw/board_departure.py rename to src/pyrmv/raw/board_departure.py diff --git a/pyrmv/raw/him_search.py b/src/pyrmv/raw/him_search.py similarity index 100% rename from pyrmv/raw/him_search.py rename to src/pyrmv/raw/him_search.py diff --git a/pyrmv/raw/journey_detail.py b/src/pyrmv/raw/journey_detail.py similarity index 100% rename from pyrmv/raw/journey_detail.py rename to src/pyrmv/raw/journey_detail.py diff --git a/pyrmv/raw/stop_by_coords.py b/src/pyrmv/raw/stop_by_coords.py similarity index 100% rename from pyrmv/raw/stop_by_coords.py rename to src/pyrmv/raw/stop_by_coords.py diff --git a/pyrmv/raw/stop_by_name.py b/src/pyrmv/raw/stop_by_name.py similarity index 100% rename from pyrmv/raw/stop_by_name.py rename to src/pyrmv/raw/stop_by_name.py diff --git a/pyrmv/raw/trip_find.py b/src/pyrmv/raw/trip_find.py similarity index 100% rename from pyrmv/raw/trip_find.py rename to src/pyrmv/raw/trip_find.py diff --git a/pyrmv/raw/trip_recon.py b/src/pyrmv/raw/trip_recon.py similarity index 100% rename from pyrmv/raw/trip_recon.py rename to src/pyrmv/raw/trip_recon.py diff --git a/pyrmv/utility/__init__.py b/src/pyrmv/utility/__init__.py similarity index 100% rename from pyrmv/utility/__init__.py rename to src/pyrmv/utility/__init__.py diff --git a/pyrmv/utility/find_exception.py b/src/pyrmv/utility/find_exception.py similarity index 100% rename from pyrmv/utility/find_exception.py rename to src/pyrmv/utility/find_exception.py diff --git a/pyrmv/utility/weekdays_bitmask.py b/src/pyrmv/utility/weekdays_bitmask.py similarity index 100% rename from pyrmv/utility/weekdays_bitmask.py rename to src/pyrmv/utility/weekdays_bitmask.py diff --git a/test.py b/test.py deleted file mode 100644 index f2f9085..0000000 --- a/test.py +++ /dev/null @@ -1,82 +0,0 @@ -from datetime import datetime, timedelta -from os import makedirs -from typing import Any -from ujson import loads, dumps, JSONDecodeError -from test_colors import * - -import pyrmv - -try: - with open("test_key.json", mode="r", encoding="utf-8") as file: - key = loads(file.read())["key"] - file.close() -except FileNotFoundError: - key = input("File 'test_key.json' does not exist. Enter your RMV API key to continue: ").strip() - key_save = input("To skip entering your key every time I can save your apikey here. Should I do that? (Y/n) > ").strip().lower() - if key_save == "y": - try: - with open("test_key.json", mode="w", encoding="utf-8") as file: - file.write(dumps({"key": key})) - file.close() - except Exception as exp: - print(f"Could not save 'test_key.json' with your apikey due to {exp}", flush=True) - else: - print("To skip entering your key every time create file 'test_key.json' with your apikey as a value for 'key' dict key.", flush=True) - - -def test(name: str, data: Any, raw: bool = False) -> None: - - makedirs("tests", exist_ok=True) - - if isinstance(data, dict): - if "errorCode" in data: - print(f"{BBLACK}[{BRED}ER{BBLACK}] {RESET}Test of {YELLOW}{name} {RESET}did not go well. ErrorCode is {BRED}{data['errorCode']}{RESET}. Check {CYAN}tests/{name}.json {RESET}for more information.", flush=True) - else: - print(f"{BBLACK}[{BGREEN}OK{BBLACK}] {RESET}Test of {YELLOW}{name} {RESET}seems to be alright.", flush=True) - - if raw: - - try: - with open(f"tests/{name}.json", "w", encoding="utf-8") as file: - file.write(dumps(data, indent=4, ensure_ascii=False)) - file.close() - except JSONDecodeError: - print(f"{BBLACK}[{BRED}ER{BBLACK}] {RESET}Test of {YELLOW}{name} {RESET}did not go well. ErrorCode is {BRED}{data['errorCode']}{RESET}. Check {CYAN}tests/{name}.json {RESET}for more information.", flush=True) - - else: - - with open(f"tests/{name}.txt", "w", encoding="utf-8") as file: - if isinstance(data, list): - list_2 = [] - for item in data: - list_2.append(str(item)+"\n") - file.writelines(list_2) - else: - file.write(str(data)) - file.close() - - if data in ["", "\n"]: - print(f"{BBLACK}[{BRED}ER{BBLACK}] {RESET}Test of {YELLOW}{name} {RESET}did not go well. ErrorCode is {BRED}{data['errorCode']}{RESET}. Check {CYAN}tests/{name}.txt {RESET}for more information.", flush=True) # type: ignore - else: - print(f"{BBLACK}[{BGREEN}OK{BBLACK}] {RESET}Test of {YELLOW}{name} {RESET}is not empty, so might be fine. Check {CYAN}tests/{name}.txt {RESET}for more information.", flush=True) - -client = pyrmv.Client(key) - -test("raw_board_arrival", pyrmv.raw.board_arrival(key, id="A=1@O=Offenbach (Main)-Tempelsee Wilhelm-Schramm-Straße@X=8783648@Y=50083822@U=80@L=3008012@", maxJourneys=5), raw=True) -test("raw_board_departure", pyrmv.raw.board_departure(key, id="A=1@O=Offenbach (Main)-Tempelsee Wilhelm-Schramm-Straße@X=8783648@Y=50083822@U=80@L=3008012@", maxJourneys=5), raw=True) -test("raw_him_search", pyrmv.raw.him_search(key, dateE=datetime.now()+timedelta(days=10), timeE=datetime.now()+timedelta(days=10), minprio=2, trainnames=["S9"]), raw=True) -test("raw_journey_detail", pyrmv.raw.journey_detail(key, id="2|#VN#1#ST#1664906549#PI#0#ZI#12709#TA#0#DA#61022#1S#3008007#1T#1248#LS#3008043#LT#1323#PU#80#RT#1#CA#1aE#ZE#101#ZB#Bus 101 #PC#6#FR#3008007#FT#1248#TO#3008043#TT#1323#"), raw=True) -test("raw_stop_by_name", pyrmv.raw.stop_by_name(key, "Groß Karben", maxNo=3), raw=True) -test("raw_stop_by_coords", pyrmv.raw.stop_by_coords(key, 50.131140, 8.733362, radius=300, maxNo=3), raw=True) -test("raw_trip_find", pyrmv.raw.trip_find(key, originCoordLat="50.084659", originCoordLong="8.785948", destCoordLat=50.1233048, destCoordLong=8.6129742, trafficMessages=True, numF=3), raw=True) -test("raw_trip_recon", pyrmv.raw.trip_recon(key, ctx="¶HKI¶G@F$A=2@O=50.084659, 8.785948@X=8785948@Y=50084659@u=0@a=128@$A=1@O=Offenbach (Main)-Tempelsee Wilhelm-Schramm-Straße@L=3008012@a=128@$202210061243$202210061247$$$1$$$$$$§T$A=1@O=Offenbach (Main)-Tempelsee Wilhelm-Schramm-Straße@L=3008012@a=128@$A=1@O=Offenbach (Main)-Zentrum Marktplatz/Frankf. Straße@L=3002510@a=128@$202210061247$202210061300$Bus 101 $$1$$$$$$§W$A=1@O=Offenbach (Main)-Zentrum Marktplatz/Frankf. Straße@L=3002510@a=128@$A=1@O=Offenbach (Main)-Zentrum Marktplatz@L=3011265@a=128@$202210061300$202210061304$$$1$$$$$$§T$A=1@O=Offenbach (Main)-Zentrum Marktplatz@L=3011265@a=128@$A=1@O=Frankfurt (Main) Taunusanlage@L=3000011@a=128@$202210061306$202210061319$ S2$$1$$$$$$§T$A=1@O=Frankfurt (Main) Taunusanlage@L=3000011@a=128@$A=1@O=Frankfurt (Main) Rödelheim Bahnhof@L=3001217@a=128@$202210061322$202210061333$ S5$$1$$$$$$§G@F$A=1@O=Frankfurt (Main) Rödelheim Bahnhof@L=3001217@a=128@$A=2@O=50.123304, 8.612974@X=8612974@Y=50123304@u=0@a=128@$202210061333$202210061344$$$1$$$$$$¶GP¶ft@0@2000@120@1@100@1@@0@@@@@false@0@-1@0@-1@-1@$f@$f@$f@$f@$f@$§bt@0@2000@120@1@100@1@@0@@@@@false@0@-1@0@-1@-1@$f@$f@$f@$f@$f@$§tt@0@2000@120@1@100@1@@0@@@@@false@0@-1@0@-1@-1@$f@$f@$f@$f@$f@$§¶KRCC¶#VE#1#"), raw=True) - -test("board_arrival", client.board_arrival("A=1@O=Frankfurt (Main) Taunusanlage@X=8668765@Y=50113478@U=80@L=3000011@", journeys_max=5)) -test("board_departure", client.board_departure("A=1@O=Frankfurt (Main) Taunusanlage@X=8668765@Y=50113478@U=80@L=3000011@", journeys_max=5, retrieve_stops=False)) -test("him_search", client.him_search(date_end=datetime.now()+timedelta(days=10), priority_min=2, train_names=["S9"])) -test("journey_detail", client.journey_detail("2|#VN#1#ST#1664906549#PI#0#ZI#12709#TA#0#DA#61022#1S#3008007#1T#1248#LS#3008043#LT#1323#PU#80#RT#1#CA#1aE#ZE#101#ZB#Bus 101 #PC#6#FR#3008007#FT#1248#TO#3008043#TT#1323#", real_time_mode=pyrmv.enums.RealTimeMode.FULL)) -test("stop_by_coords", client.stop_by_coords(50.131140, 8.733362, radius=300, max_number=3)) -test("stop_by_id", client.stop_by_id("A=1@O=Offenbach (Main)-Zentrum Marktplatz/Frankf. Straße@X=8764456@Y=50105181@U=80@L=3002510@")) -test("stop_by_name", client.stop_by_name("Groß Karben", max_number=3)) -test("trip_find", client.trip_find(origin_coord_lat="50.084659", origin_coord_lon="8.785948", destination_coord_lat=50.1233048, destination_coord_lon=8.6129742, messages=True)) -test("trip_recon", client.trip_recon( client.trip_find(origin_coord_lat="50.084659", origin_coord_lon="8.785948", destination_coord_lat=50.1233048, destination_coord_lon=8.6129742, messages=True, trips_after_time=1)[0] )) \ No newline at end of file diff --git a/test_colors.py b/test_colors.py deleted file mode 100644 index c4e99eb..0000000 --- a/test_colors.py +++ /dev/null @@ -1,19 +0,0 @@ -RESET = '\u001b[0m' -BLACK = '\u001b[30m' -RED = '\u001b[31m' -GREEN = '\u001b[32m' -YELLOW = '\u001b[33m' -BLUE = '\u001b[34m' -MAGENTA = '\u001b[35m' -CYAN = '\u001b[36m' -WHITE = '\u001b[37m' -BBLACK = '\u001b[30;1m' -BRED = '\u001b[31;1m' -BGREEN = '\u001b[32;1m' -BYELLOW = '\u001b[33;1m' -BBLUE = '\u001b[34;1m' -BMAGENTA = '\u001b[35;1m' -BCYAN = '\u001b[36;1m' -BWHITE = '\u001b[37;1m' -ULINE = '\u001b[4m' -REVERSE = '\u001b[7m' \ No newline at end of file diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..32050e0 --- /dev/null +++ b/tox.ini @@ -0,0 +1,22 @@ +[tox] +minversion = 3.8.0 +envlist = py37, py38, py39, py310, py311 +isolated_build = true + +[gh-actions] +python = + 3.7: py37 + 3.8: py38 + 3.9: py39 + 3.10: py310 + 3.11: py311 + +[testenv] +setenv = + PYTHONPATH = {toxinidir} +deps = + -r{toxinidir}/requirements/_.txt + -r{toxinidir}/requirements/dev.txt +commands = + pytest --basetemp={envtmpdir} --cov=cringepredictor --cov-report term-missing +