8000 rename log files and use pathlib.Path by javierggt · Pull Request #30 · sot/testr · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

rename log files and use pathlib.Path #30

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

Merged
merged 3 commits into from
Oct 16, 2020
Merged

rename log files and use pathlib.Path #30

merged 3 commits into from
Oct 16, 2020

Conversation

javierggt
Copy link
Contributor
@javierggt javierggt commented Oct 15, 2020

Description

Rename log files from *.sh.log to *_sh.log

Also replaced most uses of os.path by pathlib.Path.

Testing

  • Passes unit tests on MacOS, linux, Windows (at least one required) (no unit tests)
  • Functional testing. Ran run_testr from within the ska_testr directory and from ../test_testr relative to ska_testr to check that: 1.- tests pass, 2.- logs are in the right place:
    • run_testr --include Quaternion (test_spec path is None)
    • run_testr --include dpa_check --root ../ska_testr (this uses regress_dir)
    • run_testr --test-spec test_spec_Quaternion (using proper test_spec path)
    • run_testr --test-spec test_spec_Quaternion --root ../ska_testr (logs should be in outputs within CWD)
    • run_testr --test-spec test_spec_Quaternion --root ../ska_testr --outputs-dir other_output (logs should be in other_output within CWD)
    • run_testr --test-spec test_spec_Quaternion --root ../ska_testr --outputs-dir pwd_output (logs should be in the given absolute path within CWD)

Fixes #

@@ -187,7 +187,10 @@ def run_tests(package, tests):
interpreter = test['interpreter']

logger.info('Running {} {} script'.format(interpreter, test['file']))
logfile = Tee(test['file'] + '.log')
if test['file'].endswith('.sh'):
Copy link
Member

Choose a reason for hiding this comment

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

Can we just do logfile = Tee(Path(test['file']).with_suffix('.log')))? (Assuming Tee accepts a Path). The asymmetry of treating .sh doesn't spark joy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, I agree it is ugly. I will try your proposal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tee passes the path directly to open and nothing else, so this line would work.

The log_file is used in another place, which uses other functions, so I have to decide how to change it. Pathlib is not used in this module. It uses os.path heavily.

@javierggt javierggt changed the title rename log files rename log files and use pathlib.Path Oct 16, 2020
@javierggt javierggt requested a review from taldcroft October 16, 2020 16:00
Copy link
Member
@taldcroft taldcroft left a comment

Choose a reason for hiding this comment

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

+100 on pathlib. I have not looked at every code change but the functional testing looks good.

@javierggt javierggt merged commit 1ee1089 into master Oct 16, 2020
@javierggt javierggt mentioned this pull request Dec 7, 2020
@javierggt javierggt deleted the log-filenames branch April 20, 2022 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0