Code Monkey home page Code Monkey logo

knots's People

Contributors

algebra8 avatar allisonhmoore avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

knots's Issues

unit tests: move unit test files into module

Executing tests from the top level of the repository fails. It is common practice for developers to execute unit tests on the repository while making changes, and Unit Tests in particular should be executable without installing the module.

This change will streamline development work, and simplify automated testing (for CI/CD), and improve code portability (simplify refactoring).

Suggested change:
Move existing test files from the top level of the repo into tests folders at the same level as the .py files they test.
Use relative imports in the test files.

|── braidgenerator
| |---- tests
| | |---- brainword_test.py
| | |---- markovchain_test.py
│ ├── init.py
│ ├── braidword.py
│ └── markovchain.py
│ ├── decorators
| | |---- tests
| | | |---- brainword_test.py
| | | |---- markovchain_test.py
│ │ ├── init.py
│ │ ├── braidword.py
│ │ └── markovchain.py

Example Error:

> pytest
======================================= test session starts ========================================
platform linux -- Python 3.9.5, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: ~/projects/Knots
collected 0 items / 2 errors                                                                       

============================================== ERRORS ==============================================
_____________________________ ERROR collecting tests/test_braidword.py _____________________________
ImportError while importing test module '~/projects/Knots/tests/test_braidword.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../miniconda3/envs/knots/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_braidword.py:2: in <module>
    from braidgenerator import BraidWord
E   ModuleNotFoundError: No module named 'braidgenerator'
____________________________ ERROR collecting tests/test_markovchain.py ____________________________
ImportError while importing test module '~/projects/Knots/tests/test_markovchain.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../miniconda3/envs/knots/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_markovchain.py:2: in <module>
    from braidgenerator import MarkovChain
E   ModuleNotFoundError: No module named 'braidgenerator'
===================================== short test summary info ======================================
ERROR tests/test_braidword.py
ERROR tests/test_markovchain.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
======================================== 2 errors in 0.08s =========================================

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.