Skip to content
Derek Groen edited this page Oct 4, 2024 · 29 revisions

This is the wiki for FabSim3.

This wiki is a project in progress, and more examples + troubleshooting tips should be added here over time.

For the users

Instructions for Alpha Users

Troubleshooting FabSim3

For the Dev Team

Developer tips

FabSim3 Design Document

Development and testing process

Proposing changes to the code-base

We use the Github Work Flow. Here is a summary:

  1. Clone the repository (if you don't have write access to the FabSIm3 repository fork it first and clone your fork instead):

git clone https://github.com/djgroen/FabSim3.git

  1. Create a branch for your changes, name it descriptively:

git checkout -b my_branch

  1. Commit changes to your branch.

git commit -am "A descriptive message describing all the changes what I've done"

  1. Push changes (either to your fork or to the main repository if you have access):

git push -u origin my_branch

  1. Create a pull request and explain what you've done and why. Look under the "Pull Requests" tab in the main GitHub page.

In order for your pull request to be accepted, all the tests have to pass. You will see a little checkmark next to your commit which indicates whether that is the case.

Using autopep8

  • installing autopep8

pip install autopep8

  • To modify a file in place

autopep8 --in-place <filename>

  • To apply for all files in your project (recursively)

  1. autopep8 --in-place --recursive .

or

  1. find . -name '*.py' -exec autopep8 --in-place '{}' \;

autopep8 --in-place --aggressive --max-line-length=79 <file_input>

Testing

Tests go under test/ subdirectory. See examples in there. We use the py.test framework which is very straightforward and does not require any boiler plate. Here is a simple way to write a test:

  1. The files containing the test should be named test_modulename.py. If no such file exists for your module, create one.
  2. Inside the tests file the functions that correspond to one test should be named test_functioname.
  3. Test with the assert statement, e.g. assert(my_function(arguments) = results).

The tests are automatically run by the travis continuous integration service.

How to run the FabSim3 tests:

Type python -m pytest tests/

Notes for Installation Testing

When testing installation scripts, both remote and local, make sure you test:

  1. Yourself.
  2. Yourself, twice in a row (to make sure cleanup is done consistently).
  3. A colleague.
  4. A colleague, twice in a row.
  5. A colleague using a different platform (Apple if you're using Linux or vice versa).