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

Double instantiation warning on running tests #23

Closed
gomezzz opened this issue Oct 19, 2022 · 6 comments
Closed

Double instantiation warning on running tests #23

gomezzz opened this issue Oct 19, 2022 · 6 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@gomezzz
Copy link
Collaborator

gomezzz commented Oct 19, 2022

Issue

Problem Description

Running tests leads to double instantiation of paseos which throws a warning.

Expected Behavior

No warning

What Needs to be Done

Change init or tests so this doesn't trigger a warning.

How Can It Be Tested or Reproduced

After checking out PR #26
python .\init_test.py
17:43:55|PASEOS-DEBUG| Setting LogLevel to DEBUG
17:43:55|PASEOS-DEBUG| Loaded module.
17:43:55|PASEOS-DEBUG| Added orbit to actor sat1
17:43:55|PASEOS-DEBUG| Added power device. MaxBattery=10000Ws, CurrBattery=500Ws, ChargingRate=1W to actor sat1
17:43:55|PASEOS-DEBUG| Initializing simulation.
17:43:55|PASEOS-DEBUG| Loading default cfg...
17:43:55|PASEOS-DEBUG| Added orbit to actor sat1
17:43:55|PASEOS-DEBUG| Added power device. MaxBattery=10000Ws, CurrBattery=500Ws, ChargingRate=1W to actor sat1
17:43:55|PASEOS-DEBUG| Initializing simulation.
17:43:55|PASEOS-WARNING| Tried to create another instance of PASEOS simulation.Keeping original one...
17:43:55|PASEOS-DEBUG| Loading default cfg...

As you can see I get this warning. I am not sure if this is a problem or this test actually is to check if this warning is raised.
17:43:55|PASEOS-DEBUG| Added orbit to actor sat1

@gomezzz gomezzz added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers labels Oct 19, 2022
@gomezzz gomezzz mentioned this issue Oct 19, 2022
2 tasks
@johanos1
Copy link
Collaborator

I cannot reproduce this error.

@GabrieleMeoni
Copy link
Collaborator

I just launched the test and got a warning, not an error, that there was an attempt to instantiate PASESOS twice.

@gomezzz
Copy link
Collaborator Author

gomezzz commented Oct 21, 2022

I fail to reproduce this on my machine

$ pytest
==================================================================== test session starts =====================================================================
platform linux -- Python 3.10.6, pytest-7.1.3, pluggy-1.0.0
rootdir: /...
collected 8 items                                                                                                                                            

activity_test.py .                                                                                                                                     [ 12%]
check_communication_test.py .                                                                                                                          [ 25%]
eclipse_test.py .                                                                                                                                      [ 37%]
import_test.py .                                                                                                                                       [ 50%]
init_test.py ..                                                                                                                                        [ 75%]
line_of_sight_test.py .                                                                                                                                [ 87%]
power_test.py .                                                                                                                                        [100%]

===================================================================== 8 passed in 1.82s ======================================================================
(paseos) 

@gomezzz
Copy link
Collaborator Author

gomezzz commented Oct 21, 2022

@GabrieleMeoni when do you get it?

@gomezzz
Copy link
Collaborator Author

gomezzz commented Oct 21, 2022

(I tested with PR #26 )

@gomezzz
Copy link
Collaborator Author

gomezzz commented Oct 28, 2022

Seems this only happens when you run the tests manually as then paseos is loaded over and over again for each test. So not a bug.

@gomezzz gomezzz closed this as completed Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants