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

Ensures consistency across codebase to ensure consistent codestyle #2951

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

Sonu0305
Copy link
Contributor

@Sonu0305 Sonu0305 commented Jan 15, 2025

📝 Description

Type: 🪲 bugfix | 🚀 feature | ☣️ breaking change | 🚦 testing | 📝 documentation | 🎢 infrastructure

All the occurences of @pytest.fixture and @fixture as suggested were changed to @pytest.fixture() and @fixture(), respectively.

Closes #2950

📌 Resources

Examples, notebooks, and links to useful references.

🚦 Testing

How did you test these changes?

  • Testing pipeline
  • Other method (describe)
  • My changes can't be tested (explain why)

☑️ Checklist

  • I requested two reviewers for this pull request
  • I updated the documentation according to my changes
  • I built the documentation by applying the build_docs label

Note: If you are not allowed to perform any of these actions, ping (@) a contributor.

@tardis-bot
Copy link
Contributor

*beep* *bop*
Hi human,
I ran ruff on the latest commit (6316bd8).
Here are the outputs produced.
Results can also be downloaded as artifacts here.
Summarised output:

5	E712  	[*] Avoid equality comparisons to `False`; use `if not ...:` for false checks
4	INP001	[ ] File `tardis/io/model/readers/tests/test_arepo_parser.py` is part of an implicit namespace package. Add an `__init__.py`.
2	PT013 	[ ] Incorrect import of `pytest`; use `import pytest` instead
2	I001  	[*] Import block is un-sorted or un-formatted
2	F401  	[*] `tardis.tests.test_util.monkeysession` imported but unused
2	F811  	[ ] Redefinition of unused `monkeysession` from line 5
1	B017  	[ ] `pytest.raises(Exception)` should be considered evil

Complete output(might be large):

tardis/io/model/readers/tests/test_arepo_parser.py:1:1: INP001 File `tardis/io/model/readers/tests/test_arepo_parser.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/io/model/readers/tests/test_cmfgen_reader.py:1:1: INP001 File `tardis/io/model/readers/tests/test_cmfgen_reader.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/io/model/readers/tests/test_cmfgen_reader.py:4:1: PT013 Incorrect import of `pytest`; use `import pytest` instead
tardis/io/model/readers/tests/test_csvy_reader.py:1:1: INP001 File `tardis/io/model/readers/tests/test_csvy_reader.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/io/model/readers/tests/test_csvy_reader.py:48:10: B017 `pytest.raises(Exception)` should be considered evil
tardis/io/model/readers/tests/test_stella_reader.py:1:1: INP001 File `tardis/io/model/readers/tests/test_stella_reader.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/io/model/readers/tests/test_stella_reader.py:5:1: PT013 Incorrect import of `pytest`; use `import pytest` instead
tardis/visualization/widgets/tests/test_line_info.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/visualization/widgets/tests/test_line_info.py:7:36: F401 [*] `tardis.tests.test_util.monkeysession` imported but unused
tardis/visualization/widgets/tests/test_line_info.py:43:20: E712 Avoid equality comparisons to `False`; use `if not species_interactions_df.all(axis=None):` for false checks
tardis/visualization/widgets/tests/test_line_info.py:66:12: E712 Avoid equality comparisons to `False`; use `if not species_interactions_df.all(axis=None):` for false checks
tardis/visualization/widgets/tests/test_line_info.py:89:20: E712 Avoid equality comparisons to `False`; use `if not last_line_counts_df.all(axis=None):` for false checks
tardis/visualization/widgets/tests/test_line_info.py:145:66: F811 Redefinition of unused `monkeysession` from line 7
tardis/visualization/widgets/tests/test_line_info.py:289:16: E712 Avoid equality comparisons to `False`; use `if not bool(selected_species):` for false checks
tardis/visualization/widgets/tests/test_line_info.py:335:12: E712 Avoid equality comparisons to `False`; use `if not ...:` for false checks
tardis/visualization/widgets/tests/test_shell_info.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/visualization/widgets/tests/test_shell_info.py:5:36: F401 [*] `tardis.tests.test_util.monkeysession` imported but unused
tardis/visualization/widgets/tests/test_shell_info.py:144:50: F811 Redefinition of unused `monkeysession` from line 5
Found 18 errors.
[*] 4 fixable with the `--fix` option (5 hidden fixes can be enabled with the `--unsafe-fixes` option).

Copy link

codecov bot commented Jan 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.39%. Comparing base (5e2d0bb) to head (6316bd8).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2951      +/-   ##
==========================================
- Coverage   69.74%   69.39%   -0.35%     
==========================================
  Files         224      224              
  Lines       16313    16313              
==========================================
- Hits        11377    11320      -57     
- Misses       4936     4993      +57     

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

@Sonu0305
Copy link
Contributor Author

Hi @andrewfullard @jvshields @KasukabeDefenceForce ,
Could you please review when you have a chance, Thank You.

@tardis-bot
Copy link
Contributor

*beep* *bop*
Hi human,
I ran benchmarks as you asked comparing master (5e2d0bb) and the latest commit (6316bd8).
Here are the logs produced by ASV.
Results can also be downloaded as artifacts here.

Significantly changed benchmarks:

All benchmarks:

Benchmarks that have stayed the same:

| Change   | Before [5e2d0bb3] <master>   | After [6316bd88]    | Ratio   | Benchmark (Parameter)                                                                                                               |
|----------|------------------------------|---------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------|
|          | 22.1±5μs                     | 33.7±10μs           | ~1.53   | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_last_interaction_tracker_list |
|          | 3.16±0.6μs                   | 3.74±0.5μs          | ~1.18   | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_within_shell                              |
|          | 1.45±0.3μs                   | 1.67±0.4μs          | ~1.15   | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_line                    |
|          | 51.3±30μs                    | 57.9±40μs           | ~1.13   | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_scatter                                          |
|          | 3.43±0.5μs                   | 3.07±0.4μs          | ~0.89   | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_bad_vpacket                                       |
|          | 3.52±0.02ms                  | 2.55±0.01ms         | ~0.72   | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('scatter')                                     |
|          | 7.00±1μs                     | 7.65±3μs            | 1.09    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_volley                                    |
|          | 40.0±20μs                    | 42.3±20μs           | 1.06    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_emission                                         |
|          | 2.79±0.5ms                   | 2.95±0.5ms          | 1.06    | transport_montecarlo_single_packet_loop.BenchmarkTransportMontecarloSinglePacketLoop.time_single_packet_loop                        |
|          | 521±100ns                    | 531±100ns           | 1.02    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation                                      |
|          | 726±0.3ns                    | 737±0.2ns           | 1.02    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_thomson_scatter                                       |
|          | 1.68±0ms                     | 1.72±0.01ms         | 1.02    | transport_montecarlo_main_loop.BenchmarkTransportMontecarloMontecarloMainLoop.time_montecarlo_main_loop                             |
|          | 37.5±0.1μs                   | 38.2±0μs            | 1.02    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list                  |
|          | 1.05±0m                      | 1.06±0m             | 1.01    | run_tardis.BenchmarkRunTardis.time_run_tardis_rpacket_tracking                                                                      |
|          | 1.20±0μs                     | 1.21±0μs            | 1.01    | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_boundary                |
|          | 562±100ns                    | 561±100ns           | 1.00    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_pair_creation_opacity_calculation                                |
|          | 39.5±0.3s                    | 39.4±0.2s           | 1.00    | run_tardis.BenchmarkRunTardis.time_run_tardis                                                                                       |
|          | 2.09±0m                      | 2.09±0m             | 1.00    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_FormalIntegrator_functions                                 |
|          | 204±0.09ns                   | 203±0.1ns           | 0.99    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_intensity_black_body                                       |
|          | 66.4±0.2ms                   | 65.5±0.1ms          | 0.99    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_rpacket_trackers_to_dataframe                  |
|          | 3.99±0.1ms                   | 3.83±0.05ms         | 0.96    | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('macroatom')                                   |
|          | 2.15±2μs                     | 2.04±1μs            | 0.95    | transport_montecarlo_estimators_radfield_estimator_calcs.BenchmarkMontecarloMontecarloNumbaPacket.time_update_line_estimators       |
|          | 622±200ns                    | 581±100ns           | 0.93    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_photoabsorption_opacity_calculation                              |
|          | 7.52±0.9μs                   | 6.99±0.9μs          | 0.93    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket                                           |

If you want to see the graph of the results, you can check it here

@Sonu0305
Copy link
Contributor Author

@andrewfullard ,
All the tests are passing successfully, so could you please review when you have a chance, Thank You.

@andrewfullard
Copy link
Contributor

We appreciate your enthusiasm, but we do not have the capability to review the large number of PRs you are making. Further PRs will not increase your acceptance chance.

@Sonu0305
Copy link
Contributor Author

We appreciate your enthusiasm, but we do not have the capability to review the large number of PRs you are making. Further PRs will not increase your acceptance chance.

Thank you for your feedback and for taking the time to review my contributions. I understand the need to avoid overwhelming the review process, and I apologize for the large number of PRs I submitted.
Thank you again for your understanding, and please let me know if there are any specific areas or tasks where I can focus my efforts to be most helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent usage of the pytest decorators
3 participants