X Tutup
Skip to content

DOC: Adding testing guidelines for RocketPy#626

Merged
lucasfourier merged 4 commits intodevelopfrom
doc/adding-testing-guidelines
Jul 1, 2024
Merged

DOC: Adding testing guidelines for RocketPy#626
lucasfourier merged 4 commits intodevelopfrom
doc/adding-testing-guidelines

Conversation

@lucasfourier
Copy link
Contributor

Pull request type

  • Code changes (bugfix, features)
  • Code maintenance (refactoring, formatting, tests)
  • ReadMe, Docs and GitHub updates
  • Other (please describe):

Checklist

  • Tests for the changes have been added (if needed)
  • Docs have been reviewed and added / updated
  • Lint (black rocketpy/ tests/) has passed locally
  • All tests (pytest tests -m slow --runslow) have passed locally
  • CHANGELOG.md has been updated (if relevant)

Current behavior

Currently, RocketPy docs does not formally define guidelines for contributions regarding tests.

New behavior

From now on, RocketPy will have formal guidelines for developers seeking to contribute for the test suite.

Breaking change

  • Yes
  • No

Additional information

New part of the docs:
image

@lucasfourier lucasfourier added Docs Docs and examples related Tests Regarding Tests labels Jun 26, 2024
@lucasfourier lucasfourier requested a review from a team as a code owner June 26, 2024 22:15
@lucasfourier lucasfourier changed the title Adding testing guidelines for RocketPy DOC: Adding testing guidelines for RocketPy Jun 27, 2024
Copy link
Collaborator

@GabrielBarberini GabrielBarberini left a comment

Choose a reason for hiding this comment

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

Amazing initiative! Thanks for writing this out, it will definitely reduce friction for people willing to contribute to the project.

I just added some comments and minor observations, but apart from the discussion on the integration session everything else is quite optional, feel free to accept what you also agree with.

Copy link
Member

@Gui-FernandesBR Gui-FernandesBR left a comment

Choose a reason for hiding this comment

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

Nice one! Just fixz what Gabriel mentioned and you are good to go!

Take in mind that in this repo we also define some "tests" in the docstring of some methods.
This is something done more for example purposes, but it is also executed in the CI.

For example:

    def to_frequency_domain(self, lower, upper, sampling_frequency, remove_dc=True):
        """Performs the conversion of the Function to the Frequency Domain and
        returns the result. This is done by taking the Fourier transform of the
        Function. The resulting frequency domain is symmetric, i.e., the
        negative frequencies are included as well.

        Parameters
        ----------
        lower : float
            Lower bound of the time range.
        upper : float
            Upper bound of the time range.
        sampling_frequency : float
            Sampling frequency at which to perform the Fourier transform.
        remove_dc : bool, optional
            If True, the DC component is removed from the Fourier transform.

        Returns
        -------
        Function
            The Function in the frequency domain.

        Examples
        --------
        >>> from rocketpy import Function
        >>> import numpy as np
        >>> main_frequency = 10 # Hz
        >>> time = np.linspace(0, 10, 1000)
        >>> signal = np.sin(2 * np.pi * main_frequency * time)
        >>> time_domain = Function(np.array([time, signal]).T)
        >>> frequency_domain = time_domain.to_frequency_domain(
        ...     lower=0, upper=10, sampling_frequency=100
        ... )
        >>> peak_frequencies_index = np.where(frequency_domain[:, 1] > 0.001)
        >>> peak_frequencies = frequency_domain[peak_frequencies_index, 0]
        >>> print(peak_frequencies)
        [[-10.  10.]]
        """

@lucasfourier lucasfourier merged commit a5ef85b into develop Jul 1, 2024
@lucasfourier lucasfourier deleted the doc/adding-testing-guidelines branch July 1, 2024 19:40
@lucasfourier lucasfourier restored the doc/adding-testing-guidelines branch July 1, 2024 19:47
@lucasfourier lucasfourier deleted the doc/adding-testing-guidelines branch July 1, 2024 19:50
@Gui-FernandesBR Gui-FernandesBR linked an issue Jul 4, 2024 that may be closed by this pull request
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Docs Docs and examples related Tests Regarding Tests

Projects

No open projects
Status: Closed

Development

Successfully merging this pull request may close these issues.

TST: Restructuring the test suite

3 participants

X Tutup