Skip to content

Commit

Permalink
python/locomotive-engineer: 2nd iteration - new project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
vpayno committed Jan 17, 2024
1 parent 5e62d4d commit ee1af22
Show file tree
Hide file tree
Showing 18 changed files with 221 additions and 210 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" ?>
<coverage version="7.2.3" timestamp="1683095091297" lines-valid="19" lines-covered="19" line-rate="1" branches-valid="4" branches-covered="4" branch-rate="1" complexity="0">
<!-- Generated by coverage.py: https://coverage.readthedocs.io/en/7.2.3 -->
<coverage version="7.4.0" timestamp="1705508307200" lines-valid="19" lines-covered="19" line-rate="1" branches-valid="2" branches-covered="2" branch-rate="1" complexity="0">
<!-- Generated by coverage.py: https://coverage.readthedocs.io/en/7.4.0 -->
<!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd -->
<sources>
<source>/home/vpayno/git_vpayno/exercism-workspace/python/locomotive-engineer</source>
Expand All @@ -27,7 +27,7 @@
<line number="53" hits="1"/>
<line number="59" hits="1"/>
<line number="63" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="64" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="64" hits="1"/>
<line number="65" hits="1"/>
<line number="67" hits="1"/>
</lines>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions python/locomotive-engineer/pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[pytest]
pythonpath = .
addopts = --doctest-modules
markers =
task: exercise task/step
211 changes: 211 additions & 0 deletions python/locomotive-engineer/run-tests-python.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
Running automated test file(s):


===============================================================================

Running: pylint ./src
************* Module locomotive_engineer.locomotive_engineer
src/locomotive_engineer/locomotive_engineer.py:25:0: C0301: Line too long (102/100) (line-too-long)
src/locomotive_engineer/locomotive_engineer.py:39:0: C0301: Line too long (110/100) (line-too-long)

-------------------------------------------------------------------
Your code has been rated at 9.05/10 (previous run: 10.00/10, -0.95)


real 0m0.868s
user 0m0.755s
sys 0m0.116s

===============================================================================

Running: ruff check --ignore E501 ./src

real 0m0.104s
user 0m0.034s
sys 0m0.076s

===============================================================================

Running: pyright --stats ./src
Found 2 source files
pyright 1.1.347
0 errors, 0 warnings, 0 informations
Completed in 0.583sec

Analysis stats
Total files parsed and bound: 20
Total files checked: 2

Timing stats
Find Source Files: 0sec
Read Source Files: 0.01sec
Tokenize: 0.03sec
Parse: 0.04sec
Resolve Imports: 0.05sec
Bind: 0.05sec
Check: 0.08sec
Detect Cycles: 0sec

real 0m1.453s
user 0m1.211s
sys 0m0.179s

===============================================================================

Running: bandit --verbose --recursive ./src
[main] INFO profile include tests: None
[main] INFO profile exclude tests: None
[main] INFO cli include tests: None
[main] INFO cli exclude tests: None
[main] INFO running on Python 3.12.1
Run started:2024-01-17 16:18:25.111547
Files in scope (2):
./src/locomotive_engineer/__init__.py (score: {SEVERITY: 0, CONFIDENCE: 0})
./src/locomotive_engineer/locomotive_engineer.py (score: {SEVERITY: 0, CONFIDENCE: 0})
Files excluded (0):

Test results:
No issues identified.

Code scanned:
Total lines of code: 45
Total lines skipped (#nosec): 0
Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0

Run metrics:
Total issues (by severity):
Undefined: 0
Low: 0
Medium: 0
High: 0
Total issues (by confidence):
Undefined: 0
Low: 0
Medium: 0
High: 0
Files skipped (0):

real 0m0.293s
user 0m0.230s
sys 0m0.066s

===============================================================================

Running: refurb ./src

real 0m1.159s
user 0m1.082s
sys 0m0.079s

===============================================================================

python -m doctest -v ./src/locomotive_engineer/__init__.py ./src/locomotive_engineer/locomotive_engineer.py
1 items had no tests:
__init__
0 tests in 1 items.
0 passed and 0 failed.
Test passed.
6 items had no tests:
locomotive_engineer
locomotive_engineer.add_missing_stops
locomotive_engineer.extend_route_information
locomotive_engineer.fix_list_of_wagons
locomotive_engineer.fix_wagon_depot
locomotive_engineer.get_list_of_wagons
0 tests in 6 items.
0 passed and 0 failed.
Test passed.

real 0m0.145s
user 0m0.077s
sys 0m0.071s


===============================================================================

==> .coveragerc <==
[run]
omit = __init__.py, *_test.py

Running: PYTHONPATH=./src pytest --verbose --cov=. --cov-branch --cov-report=term-missing --cov-report=xml:.coverage.xml -p no:randomly ./test
============================= test session starts ==============================
platform linux -- Python 3.12.1, pytest-7.4.3, pluggy-1.3.0 -- /home/vpayno/.pyenv/versions/3.12.1/bin/python
cachedir: .pytest_cache
rootdir: /home/vpayno/git_vpayno/exercism-workspace/python/locomotive-engineer
configfile: pytest.ini
plugins: anyio-4.2.0, libtmux-0.25.0, pylama-8.4.1, cov-4.1.0, datafiles-3.0.0, docker-2.0.1, subprocess-1.5.0, typeguard-4.1.5
collecting ... collected 5 items

test/locomotive_engineer_test.py::LocomotiveEngineerTest::test_add_missing_stops PASSED [ 20%]
test/locomotive_engineer_test.py::LocomotiveEngineerTest::test_extend_route_information PASSED [ 40%]
test/locomotive_engineer_test.py::LocomotiveEngineerTest::test_fix_list_of_wagons PASSED [ 60%]
test/locomotive_engineer_test.py::LocomotiveEngineerTest::test_fix_wagon_depot PASSED [ 80%]
test/locomotive_engineer_test.py::LocomotiveEngineerTest::test_get_list_of_wagons PASSED [100%]

---------- coverage: platform linux, python 3.12.1-final-0 -----------
Name Stmts Miss Branch BrPart Cover Missing
--------------------------------------------------------------------
locomotive_engineer.py 19 0 2 0 100%
--------------------------------------------------------------------
TOTAL 19 0 2 0 100%
Coverage XML written to file .coverage.xml


============================== 5 passed in 0.07s ===============================

real 0m0.848s
user 0m0.722s
sys 0m0.127s

===============================================================================

Running: coverage report --show-missing
Name Stmts Miss Branch BrPart Cover Missing
--------------------------------------------------------------------
locomotive_engineer.py 19 0 2 0 100%
--------------------------------------------------------------------
TOTAL 19 0 2 0 100%

real 0m0.161s
user 0m0.095s
sys 0m0.060s

===============================================================================

coverage annotate

real 0m0.181s
user 0m0.113s
sys 0m0.071s

tail -n 10000 ./*,cover | grep -E -C 3 '^> def |^! '

> def get_list_of_wagons(*args: str) -> List[str]:
> """Return a list of wagons.
--

> def fix_list_of_wagons(each_wagons_id: List[int], missing_wagons: List[int]) -> List[int]:
> """Fix the list of wagons.
--

> def add_missing_stops(route: Dict[str, str | List[str]], **kwargs: str) -> Dict[str, str | List[str]]:
> """Add missing stops to route dict.
--

> def extend_route_information(route: Dict[str, str], more_route_information: Dict[str, str]) -> Dict[str, str]:
> """Extend route information with more_route_information.
--

> def fix_wagon_depot(wagons_rows: List[List[Tuple[int, str]]]) -> List[List[Tuple[int, str]]]:
> """Fix the list of rows of wagons.

===============================================================================

Running: misspell ./src/locomotive_engineer/__init__.py ./src/locomotive_engineer/locomotive_engineer.py

real 0m0.021s
user 0m0.025s
sys 0m0.008s

===============================================================================

File renamed without changes.
Empty file.
Loading

0 comments on commit ee1af22

Please sign in to comment.