Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce number of warnings emitted during testing #2887

Merged
merged 17 commits into from
Jan 25, 2024

Commits on Jan 7, 2024

  1. tests/Composition: Check that running/executing with no inputs produc…

    …es a warning
    
    Fixes 2 instances of: UserWarning: No inputs provided in call to ...
    
    Signed-off-by: Jan Vesely <[email protected]>
    jvesely committed Jan 7, 2024
    Configuration menu
    Copy the full SHA
    3de156c View commit details
    Browse the repository at this point in the history
  2. tests/learning: Enable node_spec_types test.

    Simplify parametrization ids.
    
    Fixes: SyntaxWarning: "is" with a literal. Did you mean "=="?
    Signed-off-by: Jan Vesely <[email protected]>
    jvesely committed Jan 7, 2024
    Configuration menu
    Copy the full SHA
    41b041c View commit details
    Browse the repository at this point in the history
  3. tests/LCA: Add invocation wrapper to use in benchmark fixture

    Return both result and num_executions_before_finished.
    
    Fixes: PytestBenchmarkWarning: Benchmark fixture was not used at all in this test!
    Signed-off-by: Jan Vesely <[email protected]>
    jvesely committed Jan 7, 2024
    Configuration menu
    Copy the full SHA
    f83218d View commit details
    Browse the repository at this point in the history
  4. tests/control: Only consider first 10 values in checks

    Makes the test benchmark agnostic.
    Remove explicit benchmark re-run from the test.
    
    Fixes: PytestBenchmarkWarning: Benchmark fixture was not used at all in this test!
    Signed-off-by: Jan Vesely <[email protected]>
    jvesely committed Jan 7, 2024
    Configuration menu
    Copy the full SHA
    a6242aa View commit details
    Browse the repository at this point in the history
  5. setup: Remove stale warning filter.

    Having multiple parameter ports for parameters of the same name is now an
    error.
    There is no difference in emitted warnings with or without this filter.
    
    Signed-off-by: Jan Vesely <[email protected]>
    jvesely committed Jan 7, 2024
    Configuration menu
    Copy the full SHA
    52c89dc View commit details
    Browse the repository at this point in the history
  6. tests/Composition: Remove spurious return statement

    Tests should not return anything.
    Fixes: PytestReturnNotNoneWarning: Expected None, but tests/composition/test_composition.py::TestNestedCompositions::test_invalid_projection_deletion_when_nesting_comps returned (Composition ocomp), which will be an error in a future version of pytest.  Did you mean to use `assert` instead of `return`?
    
    Signed-off-by: Jan Vesely <[email protected]>
    jvesely committed Jan 7, 2024
    Configuration menu
    Copy the full SHA
    fc75cd2 View commit details
    Browse the repository at this point in the history
  7. tests: Don't use deprecated pytest.warns(None)

    The construct has been deprecated in pytest warns about it:
    PytestRemovedIn8Warning: Passing None has been deprecated.
      See https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests for alternatives in common use cases.
    
    Address three different situations in tests in a way that does not hide
    unrelated warnings.
     * test_composition.py::*_subset_duplicate_warnings:
       capture all warnings and search them for the expected message if
       verbosity == True
       assert that there are no warnings if verbosity == False
    
     * test_projection_specifications.py::test_no_warning_when_matrix_specified:
       Use filterwarnings mark to change the undesired warning into an error
    
     * test_control.py::test_model_based_num_estimates
       Use null context or pytest.warns context based on whether warning is
       expected
    
    Signed-off-by: Jan Vesely <[email protected]>
    jvesely committed Jan 7, 2024
    Configuration menu
    Copy the full SHA
    dbb30cb View commit details
    Browse the repository at this point in the history
  8. tests/MemoryFunctions: Escape special characters in regexp

    Square brackets '[' denote a match set and need to be escaped.
    Fixes: FutureWarning: Possible nested set at position ...
    
    Signed-off-by: Jan Vesely <[email protected]>
    jvesely committed Jan 7, 2024
    Configuration menu
    Copy the full SHA
    a532afb View commit details
    Browse the repository at this point in the history

Commits on Jan 12, 2024

  1. Functions/MemoryFunctions: Do not use comparisons to empty list

    Convert tested value to np.array and check its size.
    
    Fixes:
      DeprecationWarning: The truth value of an empty array is ambiguous.  ...
      DeprecationWarning: elementwise comparison failed; ...
    Signed-off-by: Jan Vesely <[email protected]>
    jvesely committed Jan 12, 2024
    Configuration menu
    Copy the full SHA
    12cffac View commit details
    Browse the repository at this point in the history
  2. Distance, LinearCombination: Only compute np.log if needed

    The expression replaces calculated np.log values with 0
    if both v1 and v2 values at a given index are 0.
    Skip the computation of np.log(v2) in this case to avoid invalid values.
    
    Fixes:
      RuntimeWarning: divide by zero encountered in log
      RuntimeWarning: invalid value encountered in multiply
    
    Signed-off-by: Jan Vesely <[email protected]>
    jvesely committed Jan 12, 2024
    Configuration menu
    Copy the full SHA
    fcd842c View commit details
    Browse the repository at this point in the history
  3. Port/_parse_port_spec: Convert value to string to compare to keyword

    Otherwise they might end up compared as containers.
    
    Fixes:
       FutureWarning: elementwise comparison failed; ...
    Signed-off-by: Jan Vesely <[email protected]>
    jvesely committed Jan 12, 2024
    Configuration menu
    Copy the full SHA
    0e960c1 View commit details
    Browse the repository at this point in the history

Commits on Jan 20, 2024

  1. Configuration menu
    Copy the full SHA
    b267b0a View commit details
    Browse the repository at this point in the history

Commits on Jan 21, 2024

  1. treewide: Assign values to ".base" attribute of a modulated Parameter

    Fixes 3 instances of:
      FutureWarning: Setting parameter values directly using dot notation may be removed in a future release.
    
    Signed-off-by: Jan Vesely <[email protected]>
    jvesely committed Jan 21, 2024
    Configuration menu
    Copy the full SHA
    2a3f89e View commit details
    Browse the repository at this point in the history
  2. tests/RecurrentTransferMechanism: Use matrix.modulated or get_mod_mat…

    …rix() instead of mod_matrix
    
    The latter is deprecated.
    
    Signed-off-by: Jan Vesely <[email protected]>
    jvesely committed Jan 21, 2024
    Configuration menu
    Copy the full SHA
    15fcba7 View commit details
    Browse the repository at this point in the history
  3. setup: Error on SyntaxWarnings

    Signed-off-by: Jan Vesely <[email protected]>
    jvesely committed Jan 21, 2024
    Configuration menu
    Copy the full SHA
    16c70ce View commit details
    Browse the repository at this point in the history

Commits on Jan 23, 2024

  1. Configuration menu
    Copy the full SHA
    6874f84 View commit details
    Browse the repository at this point in the history

Commits on Jan 25, 2024

  1. Configuration menu
    Copy the full SHA
    b453f72 View commit details
    Browse the repository at this point in the history