Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: Unwanted execution of unittest
Post: RE: Unwanted execution of unittest
(Nov-10-2022, 09:41 AM)Larz60+ Wrote: seanhystad Wrote:The reporting stinks compared to running in a test runner, so I don't know why you would want this.
Take a situation (hypothetical or real)... |
|
ThomasFab |
General Coding Help |
9 |
2,094 |
Nov-15-2022, 12:17 PM |
|
|
Thread: Unwanted execution of unittest
Post: RE: Unwanted execution of unittest
Quote:Are you running the test using the test runner in pycharm? That does not run the test file as a python program. It imports the file and runs the test classes. Changing "if True:" to "if False... |
|
ThomasFab |
General Coding Help |
9 |
2,094 |
Nov-09-2022, 10:18 AM |
|
|
Thread: Unwanted execution of unittest
Post: RE: Unwanted execution of unittest
(Nov-08-2022, 11:57 AM)ThomasFab Wrote: (Nov-08-2022, 11:45 AM)Larz60+ Wrote: think about these statements in your code:
if __name__ == "__main__":
if True:
unittest.TextTestRunner(ver... |
|
ThomasFab |
General Coding Help |
9 |
2,094 |
Nov-08-2022, 11:59 AM |
|
|
Thread: Unwanted execution of unittest
Post: RE: Unwanted execution of unittest
(Nov-08-2022, 11:45 AM)Larz60+ Wrote: think about these statements in your code:
if __name__ == "__main__":
if True:
unittest.TextTestRunner(verbosity=2).run(suite()) # run the testthe s... |
|
ThomasFab |
General Coding Help |
9 |
2,094 |
Nov-08-2022, 11:57 AM |
|
|
Thread: Unwanted execution of unittest
Post: Unwanted execution of unittest
Hi Guys,
I`m trying to learn unit testing with the unittest libary.
I have created this modules:
unit_testing -> the "master"
test_demo_math_module
test_demo_physics_module
demo_math_modul... |
|
ThomasFab |
General Coding Help |
9 |
2,094 |
Nov-08-2022, 10:12 AM |
|
|
Thread: Can´t create a class for frames
Post: RE: Can´t create a class for frames
Correction:
[quote="deanhystad" pid='162134' dateline='1664293788']
Just a small change to make a much better better solution:
[python]class CustomFrames(tk.Frame):
def __init__(self, parent, na... |
|
ThomasFab |
GUI |
5 |
2,057 |
Sep-28-2022, 09:02 AM |
|
|
Thread: Can´t create a class for frames
Post: RE: Can´t create a class for frames
(Sep-27-2022, 03:49 PM)deanhystad Wrote: Just a small change to make a much better better solution:
class CustomFrames(tk.Frame):
def __init__(self, parent, name, *args, **kwargs):
sup... |
|
ThomasFab |
GUI |
5 |
2,057 |
Sep-28-2022, 05:46 AM |
|
|
Thread: Can´t create a class for frames
Post: RE: Can´t create a class for frames
Finally I found a solution:
class CustomFrames(tk.Frame):
def __init__(self,parent):
super().__init__(parent)
#self.parent.add(self.frame, text="Start ")
... |
|
ThomasFab |
GUI |
5 |
2,057 |
Sep-27-2022, 01:50 PM |
|
|
Thread: Can´t create a class for frames
Post: Can´t create a class for frames
Hi Guys,
I need your help **angel**
This Stuff is working well:
import tkinter as tk
from tkinter import *
from tkinter import ttk, filedialog
## window
win = Tk() # Create an instance of t... |
|
ThomasFab |
GUI |
5 |
2,057 |
Sep-27-2022, 12:30 PM |
|
|
Thread: How can I import a variable from another script without executing it
Post: RE: How can I import a variable from another scrip...
(May-04-2022, 02:45 PM)bowlofred Wrote: Sounds like you're running two different programs at different times (that "other script" has run and exited before "3rd script" runs). If so, the dataframe ... |
|
ThomasFab |
General Coding Help |
12 |
7,850 |
May-06-2022, 08:03 AM |
|
|
Thread: How can I import a variable from another script without executing it
Post: RE: How can I import a variable from another scrip...
|
ThomasFab |
General Coding Help |
12 |
7,850 |
May-04-2022, 09:07 AM |
|
|
Thread: How can I import a variable from another script without executing it
Post: RE: How can I import a variable from another scrip...
Quote:I'm not sure I understand what you want here. Putting code in a if __name__=="__main__": section is what you do when you don't want it to be run on import.
If you want it to be run on import, d... |
|
ThomasFab |
General Coding Help |
12 |
7,850 |
May-04-2022, 09:06 AM |
|
|
Thread: How can I import a variable from another script without executing it
Post: RE: How can I import a variable from another scrip...
Hi Gribouillis, thanks for your idea - looks good! Smile
But I´m still wondering if it´s possible to not call a function, but only use the variable which was already loaded in the workspace then.
Exa... |
|
ThomasFab |
General Coding Help |
12 |
7,850 |
May-04-2022, 07:35 AM |
|
|
Thread: How can I import a variable from another script without executing it
Post: RE: How can I import a variable from another scrip...
(May-03-2022, 12:20 PM)Gribouillis Wrote: The solution is to write functions that you execute only when they are needed
# B01_Import_CSV_V1.py
import pandas as pd
#%% load file via static path
def... |
|
ThomasFab |
General Coding Help |
12 |
7,850 |
May-04-2022, 06:05 AM |
|
|
Thread: How can I import a variable from another script without executing it
Post: RE: How can I import a variable from another scrip...
(May-03-2022, 02:15 PM)deanhystad Wrote: Why are there two files? There isn't much code and I am not seeing any attempt at reuse. Why have the complication of having to maintain two files instead ... |
|
ThomasFab |
General Coding Help |
12 |
7,850 |
May-04-2022, 05:58 AM |
|
|
Thread: How can I import a variable from another script without executing it
Post: How can I import a variable from another script wi...
I have a little beginner issue doing imports between scripts, maybe someone can help? **blush**
I wrote 2 Modules:
- B01_Import_CSV_V1.py
In the import script, i did load a .csv and saved it as a... |
|
ThomasFab |
General Coding Help |
12 |
7,850 |
May-03-2022, 08:57 AM |