Testing and ensuring the quality of python code developed for the scripting interface

Hi!

Python scripting in Ansys Mechanical is slowly becoming more common in my team.

Initially, I would share small snippets and files with function definitions directly with those who were interested in trying it out.

Now that more people are becoming comfortable with the python interface, more engineers are writing and editing functions to solve their needs.

I would like to develop a system for proposing changes, testing and storing the code we develop. At a minimum, we need to be able to check that the functions we write keep working in future versions of Ansys.

Writing automatic test cases with code-based model generation-meshing-solving-postprocessing would fit into the "github workflow" with a repository containing test & src files, pull requests etc. However it seems like a large undertaking to write the tests and teach this workflow.

Maintaining test cases constructed by hand seems error prone and time-intensive. However most engineers currently use hand-crafted models to test the functions they write, so in the short term there is little cost of collecting the models and storing them.

How does the Ansys developer community solve this problem? What tips and tricks can you share regarding how to organize my/our growing collection of functions?

Tagged:

Comments

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 871
    100 Answers 500 Comments 250 Likes First Anniversary
    ✭✭✭✭

    Hi @augustbrandberg , as you mentioned, the proper way to maintain code is to use a platform that allows version control and collaboration. Github is one of those platforms, and we are using it for many of our projects. You can check it out here: https://github.com/ansys

  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 338
    25 Answers 100 Comments 25 Likes First Anniversary
    ✭✭✭✭

    @augustbrandberg , I think there is a strong use case for ANSYS Minerva platform for revision control, maintaining, distributing and setting up automated testing. This would require configuration of the product, but this product is designed to be configured for different use cases.

  • augustbrandberg
    augustbrandberg Member Posts: 8
    First Anniversary Name Dropper First Comment
    **

    Thank you for your responses @Pernelle Marone-Hitz and @Mike.Thompson !

    Minerva looks interesting and it's a product I wasn't aware of. In the short term, we will attempt a github workflow.