PytLab / gaft

A Genetic Algorithm Framework in Python (not for production level)
http://gaft.readthedocs.io/
GNU General Public License v3.0
739 stars 218 forks source link

初始化运行 #38

Closed wyz-icer closed 5 years ago

wyz-icer commented 5 years ago

系统: win8.1 环境:Python 3.6.3 :: Anaconda, Inc. gitbash 操作环境: gitbash 下执行python

依照https://github.com/PytLab/gaft/blob/master/INSTALL.md 安装,运行测试文件时 python tests/*test.py 只能通过7个/(total ### [**[14个),可通过测试如下列表前七个:

  1. linear_ranking_selection_test.py
  2. linear_scaling_test.py
  3. mpiutil_test.py
  4. population_test.py
  5. roulette_wheel_selection_test.py
  6. tournament_selection_test.py
  7. uniform_crossover_test.py
  8. test_all.py
  9. individual_test.py
  10. flip_bit_mutation_test.py
  11. flip_bit_big_mutation_test.py
  12. exponential_ranking_selection_test.py
  13. engine_test.py
  14. dynamic_linear_scaling_test.py 另外7个都报的import相关问题; 示例如下: `1. python tests/flip_bit_big_mutation_test.py Traceback (most recent call last): File "tests/flip_bit_big_mutation_test.py", line 10, in from .. import GAEngine ValueError: attempted relative import beyond top-level package
  15. python tests/exponential_ranking_selection_test.py Traceback (most recent call last): File "tests/exponential_ranking_selection_test.py", line 9, in from ..components import Population, BinaryIndividual ValueError: attempted relative import beyond top-level package 测试成功结果: python tests/uniform_crossover_test.py test_cross (main.UniformCrossoverTest) Make sure individuals can be crossed correctly. ... ok

Ran 1 test in 0.000s

OK ` 另外两个例子(一维搜索和二维搜索)可以正常运行

PytLab commented 5 years ago

gaft我把tests作为一个module来处理的里面使用了relative import,你可以尝试在含有setup.py的路径下使用python setup.py test进行测试