autotest: fixed import paths for pymavlink

assumes installed package now
This commit is contained in:
Andrew Tridgell 2013-08-29 14:20:16 +10:00
parent 1b99ef5e4f
commit 4f118a85b2
8 changed files with 10 additions and 26 deletions

View File

@ -7,9 +7,6 @@ import optparse, fnmatch, time, glob, traceback, signal
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), 'pysim'))
# cope with the mavlink package not being installed, and just being a git tree
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', '..', 'mavlink'))
import util
os.environ['PYTHONUNBUFFERED'] = '1'
@ -335,8 +332,7 @@ class TestResults(object):
def write_webresults(results):
'''write webpage results'''
sys.path.insert(0, os.path.join(util.reltopdir("../mavlink/pymavlink/generator")))
import mavtemplate
from pymavlink.generator import mavtemplate
t = mavtemplate.MAVTemplate()
for h in glob.glob(util.reltopdir('Tools/autotest/web/*.html')):
html = util.loadfile(h)

View File

@ -6,13 +6,12 @@ import pexpect, os, sys, shutil, atexit
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), 'pysim'))
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', '..', 'mavlink', 'pymavlink'))
import optparse, fnmatch, time, glob, traceback, signal, util, time, math, common
import optparse, fnmatch, time, glob, traceback, signal, util, time, math, common, random
from common import *
import mavutil, mavwp, random
from pymavlink import mavutil, mavwp
import arduplane, arducopter
# Defaults
@ -263,8 +262,7 @@ class TestResults(object):
def write_XMLresults(atype, results):
'''write XML JUnit results'''
sys.path.insert(0, os.path.join(util.reltopdir("../mavlink/pymavlink/generator")))
import mavtemplate
from pymavlink.generator import mavtemplate
t = mavtemplate.MAVTemplate()
for x in glob.glob(util.reltopdir('Tools/autotest/junit.xml')):
junit_xml = util.loadfile(x)
@ -274,8 +272,7 @@ def write_XMLresults(atype, results):
def write_webresults(results):
'''write webpage results'''
sys.path.insert(0, os.path.join(util.reltopdir("../mavlink/pymavlink/generator")))
import mavtemplate
from pymavlink.generator import mavtemplate
t = mavtemplate.MAVTemplate()
for h in glob.glob(util.reltopdir('Tools/autotest/web/*.html')):
html = util.loadfile(h)

View File

@ -6,8 +6,6 @@ import pexpect, os, sys, shutil, atexit
import optparse, fnmatch, time, glob, traceback, signal
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), 'pysim'))
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', '..', 'mavlink', 'pymavlink'))
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', '..', 'mavlink', 'pymavlink', 'generator'))
import util
############## main program #############

View File

@ -5,9 +5,9 @@ import sys, os, pexpect, socket
import math, time, select, struct, signal, errno
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'pysim'))
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', '..', '..', 'mavlink', 'pymavlink'))
import util, fgFDM, atexit, fdpexpect
import util, atexit, fdpexpect
from pymavlink import fgFDM
class control_state(object):
def __init__(self):

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
import socket, struct, time, math, errno
import fgFDM
from pymavlink import fgFDM
class udp_socket(object):
'''a UDP socket'''

View File

@ -5,8 +5,7 @@ import util, time, os, sys, math
import socket, struct
import select, errno
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', '..', '..', 'mavlink', 'pymavlink'))
import fgFDM
from pymavlink import fgFDM
def sim_send(m, a):
'''send flight information to mavproxy and flightgear'''

View File

@ -8,8 +8,6 @@ import util, time, os, sys, math
import socket, struct
import select, errno
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', '..', '..', 'mavlink', 'pymavlink'))
def sim_send(a):
'''send flight information to mavproxy'''
from math import degrees

View File

@ -7,11 +7,7 @@ import pexpect
MODULE_DIR = os.path.dirname(os.path.realpath(__file__))
# This is terrible.
sys.path.insert(0,
os.path.join(MODULE_DIR, '..', '..', 'mavlink', 'pymavlink'))
import mavutil
import mavwp
from pymavlink import mavutil, mavwp
# So is this.
sys.path.insert(0, os.path.join(MODULE_DIR, 'autotest'))