dimanche 10 décembre 2017

Test .py file in another file

I have one .py file with my algorithm. In init(self) of this file I have some variables that need to be the same in all scenerios and 2 variables that I want to change for testing. I also created another .py file that is responsible to run my first file x times but every time with the same variables. My question is how should I properly create a testing enviroment for my first file to run it 10 times with different variables?

Sample of my .py file that I want to test in 10 different scenerios.

class A:
  def __init__(self):
      self.xsize = 50                
      self.ysize = 50                 
      self.max_tx_power = 200     # Variable to change
      self.min_tx_pow = 10        # Variable to change

  def alforithm(self):
      power_steps = range(self.min_tx_pow, self.max_tx_power + 1)[0::10]

  def generator(self):
      self.algorithm()

if __name__ == "__main__":
a = A()
a.generator()

Aucun commentaire:

Enregistrer un commentaire