Closed jbytecode closed 3 months ago
I think this issue is highly related to the https://github.com/SevgiAkten/pycellga/issues/25, because, once we can test the package uniformly in local machines, we can transfer the testing logic into GitHub actions for automatic checking in each single commit.
Tests can be run by typing:
$ pytest * or pytest -v
in the tests folder.
It also works from the main path with:
$ pytest -v
I fixed the code with the last commit in #25 (wrote 25 instead of 27 by mistake) but did not make any changes to the GitHub Actions yet. I will write another test files for the last added functions and write documentation for all test files. The existing tests are now working.
All the things are now better on my local computer with a warning message.
platform linux -- Python 3.12.3, pytest-8.3.2, pluggy-1.5.0
rootdir: /home/hako/code/python/pycellga/cga/tests
collected 32 items
test_ackley.py . [ 3%]
test_bit_flip_mutation.py . [ 6%]
test_bohachevsky.py . [ 9%]
test_compact_9.py . [ 12%]
test_compact_13.py . [ 15%]
test_compact_21.py . [ 18%]
test_compact_25.py . [ 21%]
test_count_sat.py . [ 25%]
test_db_utility.py . [ 28%]
test_fms.py . [ 31%]
test_grid.py . [ 34%]
test_insertion_mutation.py . [ 37%]
test_linear_5.py . [ 40%]
test_linear_9.py . [ 43%]
test_mmdp.py . [ 46%]
test_one_max.py . [ 50%]
test_one_point_crossover.py . [ 53%]
test_optimizer.py . [ 56%]
test_peak.py . [ 59%]
test_pmx_crossover.py . [ 62%]
test_rastrigin.py . [ 65%]
test_rosenbrock.py . [ 68%]
test_roulette_wheel_selection.py . [ 71%]
test_schwefel.py . [ 75%]
test_shuffle_mutation.py . [ 78%]
test_sphere.py . [ 81%]
test_swap_mutation.py . [ 84%]
test_tournament_selection.py . [ 87%]
test_tsp.py . [ 90%]
test_two_opt_mutation.py . [ 93%]
test_two_point_crossover.py . [ 96%]
test_uniform_crossover.py . [100%]
=================================================== warnings summary ===================================================
../../lib/python3.12/site-packages/dateutil/tz/tz.py:37
/home/hako/code/python/pycellga/lib/python3.12/site-packages/dateutil/tz/tz.py:37: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
EPOCH = datetime.datetime.utcfromtimestamp(0)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================================ 32 passed, 1 warning in 2.76s =============================================
I think this issue is also completely resolved and I'm closing.
I always fail to test package using
pytest
in my Linux terminal (bash or fish).How to test the package? Could you please provide an example to perform this operation? Thank you in advance.
Here is an output after performing tests in my local machine: