Skip to content

Commit

Permalink
fix distribution test
Browse files Browse the repository at this point in the history
  • Loading branch information
FusRoman committed Apr 7, 2023
1 parent 127c11b commit 352627d
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 64 deletions.
4 changes: 2 additions & 2 deletions fink_grb/distribution/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def grb_distribution(
>>> grb_distribution(
... ztfxgcn_test,
... "20230101",
... 10, 40,
... 30, 40,
... "localhost:9092",
... "toto", "tata"
... )
Expand Down Expand Up @@ -207,7 +207,7 @@ def launch_distribution(arguments):
>>> launch_distribution({
... "--config" : "fink_grb/conf/distribute_for_test.conf",
... "--night" : "20230101",
... "--exit_after" : 10
... "--exit_after" : 30
... })
>>> consumer = AlertConsumer(topics, myconfig)
Expand Down
14 changes: 0 additions & 14 deletions fink_grb/gcn_stream/gcn_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,3 @@ def load_voevent_from_file(file: io.BufferedReader, verbose:bool = False) -> Obj
"failed to load the voevent:\n\tlocation={}\n\tcause={}".format(file, e)
)
raise e


if __name__ == "__main__": # pragma: no cover
import sys
import doctest
from pandas.testing import assert_frame_equal # noqa: F401
import shutil # noqa: F401
import io # noqa: F401

if "unittest.util" in __import__("sys").modules:
# Show full diff in self.assertEqual.
__import__("sys").modules["unittest.util"]._MAX_LENGTH = 999999999

sys.exit(doctest.testmod()[0])
14 changes: 0 additions & 14 deletions fink_grb/gcn_stream/gcn_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,17 +200,3 @@ def start_gcn_stream(arguments):

load_and_parse_gcn(value, gcn_rawdatapath, logger, logs, gcn_fs=gcn_fs)
consumer.commit(gcn)


# if __name__ == "__main__": # pragma: no cover
# import sys
# import doctest
# from pandas.testing import assert_frame_equal # noqa: F401
# import pandas as pd # noqa: F401
# import shutil # noqa: F401

# if "unittest.util" in __import__("sys").modules:
# # Show full diff in self.assertEqual.
# __import__("sys").modules["unittest.util"]._MAX_LENGTH = 999999999

# sys.exit(doctest.testmod()[0])
20 changes: 0 additions & 20 deletions fink_grb/utils/fun_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1015,23 +1015,3 @@ def read_grb_admin_options(arguments, config, logger, is_test=False):
password_writer,
)


if __name__ == "__main__": # pragma: no cover
import doctest # noqa: F401
from pandas.testing import assert_frame_equal # noqa: F401
import pandas as pd # noqa: F401
import shutil # noqa: F401
from fink_grb.init import get_config, init_logging # noqa: F401
from fink_utils.spark.utils import concat_col # noqa: F401

from fink_utils.test.tester import spark_unit_tests_science

globs = globals()

path_data_fid_1 = "fink_grb/test/test_data/ztf_alert_samples_fid_1.parquet"
path_data_fid_2 = "fink_grb/test/test_data/ztf_alert_samples_fid_2.parquet"
globs["data_fid_1"] = path_data_fid_1
globs["data_fid_2"] = path_data_fid_2

# Run the test suite
spark_unit_tests_science(globs)
14 changes: 0 additions & 14 deletions fink_grb/utils/grb_prob.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,17 +239,3 @@ def grb_assoc(

return pd.Series(grb_proba)


if __name__ == "__main__": # pragma: no cover
import pandas as pd # noqa: F401
from math import sqrt # noqa: F401
from scipy import special # noqa: F401
from fink_utils.test.tester import spark_unit_tests_science
from pandas.testing import assert_frame_equal # noqa: F401

globs = globals()

join_data = "fink_grb/test/test_data/join_raw_datatest.parquet"

# Run the test suite
spark_unit_tests_science(globs)

0 comments on commit 352627d

Please sign in to comment.