diff --git a/.gitignore b/.gitignore index 36987299f0ef0403c4aaa8bd9a9a970ec940de35..0bdf5476787722ba2007a85c8c73255d56178262 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,6 @@ $RECYCLE.BIN/ *.stackdump [Dd]esktop.ini *.egg-info -__pycache__/ \ No newline at end of file +__pycache__/ +env/ +venv/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index ab4d1bf5b9226b71abff112bf9e01b5b2e7e5467..bcd7af2e6aef29c200f714f951f48554f444b880 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,13 +76,4 @@ add_custom_target( COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_LIST_DIR}/${LIBRARY_NAME}" "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${LIBRARY_NAME}" COMMENT "Copying python files to ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${LIBRARY_NAME}" DEPENDS "${TARGET_NAME}" remove_old_python_dir -) -add_custom_target( - copy_misc_files ALL - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_LIST_DIR}/README.md" "${CMAKE_CURRENT_LIST_DIR}/LICENSE" "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" - COMMENT "Copying misc. files to ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" - DEPENDS "${TARGET_NAME}" -) - -enable_testing() -add_subdirectory(test) \ No newline at end of file +) \ No newline at end of file diff --git a/README.md b/README.md index 4552c3b69a357a7d1f4beaa46f0e907ff04a8359..58025fbb44ec342680b815924844e19162ee3540 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,10 @@ # B-ASIC - Better ASIC Toolbox B-ASIC is an ASIC toolbox for Python 3 that simplifies circuit design and optimization. -## Prerequisites +## Development +How to build and debug the library during development. + +### Prerequisites The following packages are required in order to build the library: * cmake 3.8+ * gcc 7+/clang 7+/msvc 16+ @@ -16,9 +19,6 @@ The following packages are required in order to build the library: * numpy * pyside2/pyqt5 -## Development -How to build and debug the library during development. - ### Using CMake directly How to build using CMake. @@ -64,13 +64,34 @@ The output gets written to `B-ASIC/dist/b-asic-<version>.tar.gz`. #### Installation (Binary distribution) In `B-ASIC/dist`: ``` -python3 -m pip install b_asic-<version>-<python_tag>-<abi_tag>-<platform_tag>.whl +pip install b_asic-<version>-<python_tag>-<abi_tag>-<platform_tag>.whl ``` #### Installation (Source distribution) In `B-ASIC/dist`: ``` -python3 -m pip install b-asic-<version>.tar.gz +pip install b-asic-<version>.tar.gz +``` + +### Running tests +How to run the tests using pytest in a virtual environment. + +#### Linux/OS X +In `B-ASIC`: +``` +python3 -m venv env +source env/bin/activate +pip install . +pytest +``` + +#### Windows +In `B-ASIC` (as admin): +``` +python3 -m venv env +.\env\Scripts\activate.bat +pip install . +pytest ``` ## Usage @@ -78,7 +99,7 @@ How to build and use the library as a user. ### Installation ``` -python3 -m pip install b_asic +pip install b_asic ``` ### Importing @@ -88,17 +109,6 @@ python3 >>> help(asic) ``` -## Running tests -### pytest -Run all tests against installed version off b_asic using a virtual enviroment -In `B-ASIC`: -``` -python3 -m venv .venv -source .venv/bin/activate -pip install . -pytest -``` - ## License B-ASIC is distributed under the MIT license. See the included LICENSE file for more information. diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt deleted file mode 100644 index c9fd7f20850814d9fb120e9f37989510252fc6c4..0000000000000000000000000000000000000000 --- a/test/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.13) - -project("B-ASIC-test") - -add_executable( - test-main - "${CMAKE_CURRENT_SOURCE_DIR}/test_main.cpp" -) -add_test(NAME test-main COMMAND test-main) \ No newline at end of file diff --git a/tests/__init__.py b/test/__init__.py similarity index 100% rename from tests/__init__.py rename to test/__init__.py diff --git a/test/test_main.cpp b/test/test_main.cpp deleted file mode 100644 index 30ea92f72c809f93536d8a182d5cf529a07391c8..0000000000000000000000000000000000000000 --- a/test/test_main.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// TODO: Tests - -int main() { - return 0; -} \ No newline at end of file diff --git a/test/test_port.py b/test/test_port.py new file mode 100644 index 0000000000000000000000000000000000000000..62e17ea5af20a50031b2cae26ad15119b041ae5b --- /dev/null +++ b/test/test_port.py @@ -0,0 +1,9 @@ +import b_asic +import pytest + +@pytest.fixture +def outp_port(): + return b_asic.InputPort(0) + +def test_port(outp_port): + assert outp_port.signals() == [] \ No newline at end of file diff --git a/tests/test_port.py b/tests/test_port.py deleted file mode 100644 index 498233bb34c0273a7a6925b845d8c4cf590ad1b6..0000000000000000000000000000000000000000 --- a/tests/test_port.py +++ /dev/null @@ -1,10 +0,0 @@ -from b_asic import InputPort -import pytest - -@pytest.fixture -def outp_port(): - return InputPort(0) - - -def test_port(outp_port): - assert outp_port.signals() == []