Opened 5 years ago

Closed 5 years ago

#7103 closed enhancement (implemented)

Clean orphaned *pyc files

Reported by: atagar Owned by: neena
Priority: Low Milestone:
Component: Core Tor/Stem Version:
Severity: Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Hi Ravi. Quick code review for a feature suggestion that you made a while back. It's in the orphaned_pyc branch of my repository...

https://gitweb.torproject.org/user/atagar/stem.git/commitdiff/d342a8b463799367f57928c8d1e17b872b25989a

Cheers! -Damian

Child Tickets

Change History (2)

comment:1 in reply to: ↑ description Changed 5 years ago by neena

  • Status changed from new to needs_review

Hey Damian

Replying to atagar:

Hi Ravi. Quick code review for a feature suggestion that you made a while back. It's in the orphaned_pyc branch of my repository...

I sort of implemented this.

Won't be able to checkout the code until next week, since I'm travelling and without a dev machine. So, you should merge it if you think it's good. What do you think about just printing a message listing the ghost pyc files instead of deleting them? I realized it might not be 'cool' for the tests script to delete files on the disk. Also, since check_spaces it doing so much that isn't just checking spaces, you could call it lint.

comment:2 Changed 5 years ago by atagar

  • Resolution set to implemented
  • Status changed from needs_review to closed

What do you think about just printing a message listing the ghost pyc files instead of deleting them?

Hmmm, I can't think of any use case where the tester wouldn't want the orphaned pyc to be deleted. Can you?

One thing that I dislike a little bit about this change is that we now have two static analysis tasks: pyc cleanup and whitespace checking. Ideally they'd both be in the same section, but...

  • the pyc cleanup needs to come before the tests since otherwise we'll use those orphaned pycs in tests
  • the whitespace checking needs to come after the tests since otherwise the other testing output will drown it out

Oh well, guess having both pre-testing and post-testing steps isn't the end of the world.

A more concerning gotcha is that even with this change we might still test against orphaned pyc files since the test_runner.py has numerous imports *before* we clean them up. If any of those imports leads to an orphaned pyc then it'll be in memory anyway.

I'm gonna push this for now. Improvements welcome!

Note: See TracTickets for help on using tickets.