Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8159113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:48:42+00:00 2026-06-06T17:48:42+00:00

Ok. I have a class which runs this command: ffmpeg_command = ffprobe -v quiet

  • 0

Ok. I have a class which runs this command:

ffmpeg_command = "ffprobe -v quiet -print_format json -show_format -show_streams %s" % self.absolute_path

Where self.absolute_path is a path to a movie, let’s say .mpg file.

The file I am using for testing is 4GB large and I don’t want to commit it inside my GIT repo.

So I was thinking of mocking this file and creating a file called:

mock.mpg

Which would return the same string as the actual mpg movie when supplied as input to ffprobe command. Is that possible?

Or what other approach should I choose?

This is my class:

  class Movie(object):

      absolute_path = None
      info = None

      def __init__(self, path):
          self.absolute_path = "%s/%s" % (os.getcwd(), path)
          if(os.path.exists(self.absolute_path) is False):
              raise IOError("File does not exist")

          self.info = json.loads(self.get_info())

    def get_info(self):
          ffmpeg_command = "ffprobe -v quiet -print_format json -show_format -show_streams %s" % self.absolute_path
          return subprocess.check_output(ffmpeg_command, shell=True)

This is how I will be unit testing it:

  class MovieTest(unittest.TestCase):

      def test_foo(self):
          movie = Movie("tests/test_1.mpg") # this file should be a mock file!!!
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T17:48:42+00:00Added an answer on June 6, 2026 at 5:48 pm

    I would suggest that you wrap the ffmpeg dependency.

    Supply a mock for this instead. Wrapping external tools/libraries is a good idea anyway.
    If any interfaces changes, you need only to fix the wrapper anf not every connection from your code and into ffmpeg. The wrapper only need to be paper thin to get the benifit from easy unittesting.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class called FooJob() which runs on a WCF windows service. This
I have a Class A which runs activity via startActivityForResult by passing Intent to
I have a class called ModelView which inherits from NSOpenGLView. When my program runs
I have class A which extends the Activity class. This class is in package
I have class Employee which is something like this. class Emp { int EmpID;
I have got a class which is called BaseCore which just runs all the
I have a nose test that imports a file which runs a class with
I have this line of Javascript which runs a function I sourced online. However
I have an AsyncTask which calls my LocationHandler class method getLocation() which runs a
I have an class which should send/receive data in packet form. This class contains

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.