Skip to content

Add pytests to ctest#309

Merged
LecrisUT merged 2 commits intospglib:developfrom
LecrisUT:cmake/pytest
Aug 14, 2023
Merged

Add pytests to ctest#309
LecrisUT merged 2 commits intospglib:developfrom
LecrisUT:cmake/pytest

Conversation

@LecrisUT
Copy link
Copy Markdown
Collaborator

Ok, this one should help immensely for debugging. I don't know if you had a similar issue on VSCode, but for me on CLion, I couldn't get the debugger to run when I was running pytest because clion would not add the gdb debugger to that. Well, this one solves it by adding the pytest runner directly to cmake.

Here is my CMakeUserPresets.json that I use

CMakeUserPresets.json
{
  "version": 6,
  "configurePresets": [
    {
      "name": "python",
      "displayName": "With python preset",
      "binaryDir": "cmake-build-python",
      "inherits": ["default"],
      "cacheVariables": {
        "CMAKE_BUILD_TYPE": {
          "type": "STRING",
          "value": "Debug"
        },
        "SPGLIB_WITH_Python": {
          "type": "BOOL",
          "value": true
        },
        "CMAKE_INSTALL_PREFIX": {
          "type": "FILEPATH",
          "value": "install"
        }
      },
      "vendor": {
        "jetbrains.com/clion": {
          "toolchain": "spglib"
        }
      }
    }
  ],
  "buildPresets": [
    {
      "name": "python",
      "displayName": "With python preset",
      "configurePreset": "python"
    }
  ],
  "testPresets": [
    {
      "name": "python",
      "displayName": "With python preset",
      "configurePreset": "python",
      "filter": {
        "include": {
          "name": "python-tests"
        }
      }
    }
  ],
  "workflowPresets": [
    {
      "name": "python",
      "displayName": "Python workflow",
      "steps": [
        {
          "type": "configure",
          "name": "python"
        },
        {
          "type": "build",
          "name": "python"
        },
        {
          "type": "test",
          "name": "python"
        }
      ]
    }
  ]
}

It includes my clion configuration, but that can be exported for others to have an easy way of setting up their environment. There should also be an equivalent vscode approach for this.

Copy link
Copy Markdown
Member

@lan496 lan496 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I missed this PR. LGTM!

Signed-off-by: Cristian Le <[email protected]>
@LecrisUT LecrisUT force-pushed the cmake/pytest branch 5 times, most recently from 1277e66 to 6b2595c Compare August 14, 2023 11:44
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Aug 14, 2023

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.66%. Comparing base (b7abe8d) to head (6738fd7).
⚠️ Report is 548 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #309      +/-   ##
===========================================
+ Coverage    83.64%   83.66%   +0.01%     
===========================================
  Files           23       23              
  Lines         6274     6274              
===========================================
+ Hits          5248     5249       +1     
+ Misses        1026     1025       -1     
Flag Coverage Δ
c_api 74.01% <ø> (ø)
fortran_api 36.23% <ø> (ø)
python_api 80.42% <ø> (ø)
unit_tests 0.95% <ø> (-73.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Cristian Le <[email protected]>
@LecrisUT LecrisUT merged commit ae4ffde into spglib:develop Aug 14, 2023
@LecrisUT LecrisUT deleted the cmake/pytest branch August 14, 2023 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

4 participants