Skip to content
Snippets Groups Projects
Commit efcd8394 authored by Ivar Härnqvist's avatar Ivar Härnqvist
Browse files

fix test setup

parent 38b918fb
No related branches found
No related tags found
No related merge requests found
...@@ -28,4 +28,6 @@ $RECYCLE.BIN/ ...@@ -28,4 +28,6 @@ $RECYCLE.BIN/
*.stackdump *.stackdump
[Dd]esktop.ini [Dd]esktop.ini
*.egg-info *.egg-info
__pycache__/ __pycache__/
\ No newline at end of file env/
venv/
\ No newline at end of file
...@@ -76,13 +76,4 @@ add_custom_target( ...@@ -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}" 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}" COMMENT "Copying python files to ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${LIBRARY_NAME}"
DEPENDS "${TARGET_NAME}" remove_old_python_dir DEPENDS "${TARGET_NAME}" remove_old_python_dir
) )
add_custom_target( \ No newline at end of file
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
...@@ -3,7 +3,10 @@ ...@@ -3,7 +3,10 @@
# B-ASIC - Better ASIC Toolbox # B-ASIC - Better ASIC Toolbox
B-ASIC is an ASIC toolbox for Python 3 that simplifies circuit design and optimization. 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: The following packages are required in order to build the library:
* cmake 3.8+ * cmake 3.8+
* gcc 7+/clang 7+/msvc 16+ * gcc 7+/clang 7+/msvc 16+
...@@ -16,9 +19,6 @@ The following packages are required in order to build the library: ...@@ -16,9 +19,6 @@ The following packages are required in order to build the library:
* numpy * numpy
* pyside2/pyqt5 * pyside2/pyqt5
## Development
How to build and debug the library during development.
### Using CMake directly ### Using CMake directly
How to build using CMake. How to build using CMake.
...@@ -64,13 +64,34 @@ The output gets written to `B-ASIC/dist/b-asic-<version>.tar.gz`. ...@@ -64,13 +64,34 @@ The output gets written to `B-ASIC/dist/b-asic-<version>.tar.gz`.
#### Installation (Binary distribution) #### Installation (Binary distribution)
In `B-ASIC/dist`: 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) #### Installation (Source distribution)
In `B-ASIC/dist`: 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 ## Usage
...@@ -78,7 +99,7 @@ How to build and use the library as a user. ...@@ -78,7 +99,7 @@ How to build and use the library as a user.
### Installation ### Installation
``` ```
python3 -m pip install b_asic pip install b_asic
``` ```
### Importing ### Importing
...@@ -88,17 +109,6 @@ python3 ...@@ -88,17 +109,6 @@ python3
>>> help(asic) >>> 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 ## License
B-ASIC is distributed under the MIT license. B-ASIC is distributed under the MIT license.
See the included LICENSE file for more information. See the included LICENSE file for more information.
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
File moved
// TODO: Tests
int main() {
return 0;
}
\ No newline at end of file
from b_asic import InputPort import b_asic
import pytest import pytest
@pytest.fixture @pytest.fixture
def outp_port(): def outp_port():
return InputPort(0) return b_asic.InputPort(0)
def test_port(outp_port): def test_port(outp_port):
assert outp_port.signals() == [] assert outp_port.signals() == []
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment